From 3990f61c5749e543b026c9f44d868611772d80d6 Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Fri, 12 Jan 2018 13:57:58 -0800 Subject: [PATCH] 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. --- monitor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 )