libdlog: Do not remove the dynamic filter watch in library destructor 55/191655/3
authorKarol Lewandowski <k.lewandowsk@samsung.com>
Fri, 19 Oct 2018 19:07:44 +0000 (21:07 +0200)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Fri, 19 Oct 2018 19:07:44 +0000 (21:07 +0200)
Calling inotify_rm_watch() on inotify fd will remove watches for
all processes that share that inotify fd. This means that every
process that uses dlog and forks will have the dynamic config
feature broken.

This commit fixes that by removing the erroneous rm_watch.

Change-Id: If023d75937b5b435e2188aca7f70b57ce964c767

src/libdlog/dynamic_config.c

index a8fff08..807a790 100644 (file)
@@ -115,7 +115,11 @@ void __dynamic_config_destroy()
        if (inotify_fd < 0)
                return;
 
-       inotify_rm_watch(inotify_fd, inotify_wd);
+       /* Important: We can not call inotify_rm_watch() here - the
+        * process might have forked, sharing inotify_fd. Removing the
+        * watch would break monitoring capability in all processes
+        * sharing the inotify_fd.
+        */
        inotify_wd = -1;
 
        close(inotify_fd);