*/
while ((path = StrUtil_GetNextToken(&index, paths, ":")) != NULL) {
fd = open(path, O_RDONLY);
- free(path);
-
if (fd == -1) {
- err = SD_ERROR;
- break;
+ switch (errno) {
+ case EACCES:
+ /*
+ * We sometimes get access errors to virtual filesystems mounted
+ * as users with permission 700, so just ignore these.
+ */
+ Debug(LGPFX "cannot access mounted directory '%s'.\n", path);
+ free(path);
+ continue;
+
+ case EIO:
+ /*
+ * A mounted HGFS filesystem with the backend disabled will give
+ * us these; probably could use a better way to detect HFGS, but
+ * this should be enough. Just skip.
+ */
+ Debug(LGPFX "I/O error reading directory '%s'.\n", path);
+ free(path);
+ continue;
+
+ default:
+ Debug(LGPFX "failed to open '%s': %d (%s)\n",
+ path, errno, strerror(errno));
+ err = SD_ERROR;
+ free(path);
+ goto exit;
+ }
}
if (ioctl(fd, FIFREEZE) == -1) {
first = FALSE;
}
+exit:
+ sync->fds = DynBuf_Detach(&fds);
+ sync->fdCnt = count;
+
if (err != SD_SUCCESS) {
LinuxFiThaw(&sync->driver);
LinuxFiClose(&sync->driver);
- DynBuf_Destroy(&fds);
} else {
- sync->fds = DynBuf_Detach(&fds);
- sync->fdCnt = count;
*handle = &sync->driver;
}
return err;