Update handling of folders that cannot be read if parent should be skipped (#866)

* If a directory cannot be accessed, and is in a folder that should be skipped, do not print warning
This commit is contained in:
abraunegg 2020-04-15 14:07:58 +10:00 committed by GitHub
parent 1c555c3180
commit 7ca1ff95a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -151,8 +151,13 @@ final class Monitor
log.log("sudo sysctl fs.inotify.max_user_watches=524288"); log.log("sudo sysctl fs.inotify.max_user_watches=524288");
} }
if (errno() == 13) { if (errno() == 13) {
log.vlog("WARNING: inotify_add_watch failed - permission denied: ", pathname); if ((selectiveSync.getSkipDotfiles()) && (selectiveSync.isDotFile(pathname))) {
return; // no misleading output that we could not add a watch due to permission denied
return;
} else {
log.vlog("WARNING: inotify_add_watch failed - permission denied: ", pathname);
return;
}
} }
// Flag any other errors // Flag any other errors
log.error("ERROR: inotify_add_watch failed: ", pathname); log.error("ERROR: inotify_add_watch failed: ", pathname);
@ -166,11 +171,9 @@ final class Monitor
if (isDir(pathname)) { if (isDir(pathname)) {
// This is a directory // This is a directory
// is the path exluded if skip_dotfiles configured and path is a .folder? // is the path exluded if skip_dotfiles configured and path is a .folder?
if (selectiveSync.getSkipDotfiles()) { if ((selectiveSync.getSkipDotfiles()) && (selectiveSync.isDotFile(pathname))) {
if (selectiveSync.isDotFile(pathname)) { // no misleading output that we are monitoring this directory
// no misleading output that we are monitoring this directory return;
return;
}
} }
// Log that this is directory is being monitored // Log that this is directory is being monitored
log.vlog("Monitor directory: ", pathname); log.vlog("Monitor directory: ", pathname);