FYI, minor bug: no more than one FS back-end supported

Jim Meyering jim at meyering.net
Tue Dec 6 15:06:04 UTC 2011


FYI,

I've just noticed that no more than one FS back-end is supported, because
the FS back-end relies on the working directory being set by fs_init:

  static void
  fs_init (provider_t *prov)
  {
          DPRINTF("changing directory to %s\n",prov->path);
          if (chdir(prov->path) < 0) {
                  error(0,errno,_("chdir failed, unsafe to continue"));
                  exit(!0); /* Value doesn't matter, as long as it's not zero. */
          }
  }

That cannot work for two FS back-ends.
The solution is to save a directory file descriptor, dir_fd, for each
back-end and to use openat(dir_fd, ... rather than open(... when opening
files therein.


More information about the iwhd-devel mailing list