diff --git a/inotify.c b/inotify.c index 80c687a..6c32d24 100644 --- a/inotify.c +++ b/inotify.c @@ -443,6 +443,12 @@ inotify_insert_directory(int fd, char *name, const char * path) struct media_dir_s * media_path; struct stat st; + if( access(path, R_OK|X_OK) != 0 ) + { + DPRINTF(E_WARN, L_INOTIFY, "Could not access %s [%s]\n", path, strerror(errno)); + return -1; + } + parent_buf = dirname(strdup(path)); sql = sqlite3_mprintf("SELECT OBJECT_ID from OBJECTS o left join DETAILS d on (d.ID = o.DETAIL_ID)" " where d.PATH = '%q' and REF_ID is NULL", parent_buf); diff --git a/scanner.c b/scanner.c index 3114401..fbca68d 100644 --- a/scanner.c +++ b/scanner.c @@ -773,7 +773,7 @@ ScanDirectory(const char * dir, const char * parent, enum media_types dir_type) { type = resolve_unknown_type(full_path, dir_type); } - if( type == TYPE_DIR ) + if( (type == TYPE_DIR) && (access(full_path, R_OK|X_OK) == 0) ) { insert_directory(name?name:namelist[i]->d_name, full_path, BROWSEDIR_ID, (parent ? parent:""), i+startID); sprintf(parent_id, "%s$%X", (parent ? parent:""), i+startID);