monitor: Abort inotify directory scanning on quit

Add more interruption point in case we receive a quit signal while we're
scanning a large directory.
This commit is contained in:
Justin Maggard 2018-01-12 13:57:58 -08:00
parent c2a9186c71
commit 3990f61c57

View File

@ -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 )