diff --git a/monitor.c b/monitor.c index 51e66fc..a4f7359 100644 --- a/monitor.c +++ b/monitor.c @@ -527,7 +527,7 @@ monitor_insert_directory(int fd, char *name, const char * path) DPRINTF(E_ERROR, L_INOTIFY, "opendir failed! [%s]\n", strerror(errno)); return -1; } - while( (e = readdir(ds)) ) + while( !quitting && (e = readdir(ds)) ) { if( e->d_name[0] == '.' ) continue; @@ -669,7 +669,7 @@ start_inotify(void) } i = 0; - while( i < length ) + while( !quitting && i < length ) { struct inotify_event * event = (struct inotify_event *) &buffer[i]; if( event->len )