From 9e020f05cc703ef30674fbb695cfad18b7c410f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ponte-Fern=C3=A1ndez?= Date: Tue, 16 Jun 2020 22:28:55 +0200 Subject: [PATCH] Fix segfault when moving folder outside the sync directory when using --monitor (#957) Fix segfault when moving folder outside the sync directory when using --monitor on Arch Linux --- src/monitor.d | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/monitor.d b/src/monitor.d index 04093c7a..92d18b30 100644 --- a/src/monitor.d +++ b/src/monitor.d @@ -231,8 +231,6 @@ final class Monitor while (i < length) { inotify_event *event = cast(inotify_event*) &buffer[i]; string path; - path = getPath(event); - // inotify event debug log.vdebug("inotify event wd: ", event.wd); log.vdebug("inotify event mask: ", event.mask); @@ -272,6 +270,9 @@ final class Monitor throw new MonitorException("Inotify overflow, events missing"); } + // if the event is not to be ignored, obtain path + path = getPath(event); + // skip events that should be excluded based on application configuration if (selectiveSync.isDirNameExcluded(path.strip('.').strip('/'))) { goto skip;