Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incrond forks a process on invocation which is never killed #65

Open
mokraemer opened this issue Dec 23, 2019 · 2 comments
Open

incrond forks a process on invocation which is never killed #65

mokraemer opened this issue Dec 23, 2019 · 2 comments

Comments

@mokraemer
Copy link

this behaviour is new since 0.5.12, see https://bugs.mageia.org/show_bug.cgi?id=25130

Simple testcase:
$ cat /etc/incron.d/test
/tmp/in IN_CLOSE_WRITE /usr/bin/echo $@ $#

$ mkdir /tmp/in

$ systemctl start incrond.service

$ ps aux|grep incron
root 921 0.0 0.0 5532 2600 ? Ss 12:02 0:00 /usr/sbin/incrond
root 1657 0.0 0.0 28536 828 pts/12 S+ 12:02 0:00 grep --color inc

$ touch /tmp/in/a /tmp/in/b /tmp/in/c
$ ps aux|grep incron
root 921 0.0 0.0 5532 2600 ? Ss 12:02 0:00 /usr/sbin/incrond
root 2393 0.0 0.0 5532 1096 ? S 12:03 0:00 /usr/sbin/incrond
root 2394 0.0 0.0 5532 1096 ? S 12:03 0:00 /usr/sbin/incrond
root 2396 0.0 0.0 5532 1096 ? S 12:03 0:00 /usr/sbin/incrond
root 2402 0.0 0.0 5532 708 ? S 12:03 0:00 /usr/sbin/incrond
root 2404 0.0 0.0 5532 708 ? S 12:03 0:00 /usr/sbin/incrond
root 2405 0.0 0.0 5532 708 ? S 12:03 0:00 /usr/sbin/incrond
root 2410 0.0 0.0 5532 708 ? S 12:03 0:00 /usr/sbin/incrond
root 2419 0.0 0.0 28536 824 pts/12 S+ 12:03 0:00 grep --color incron

@mokraemer
Copy link
Author

Patch: adding missing exit from chrild process

diff -r 144b322c492c usertable.cpp
--- a/usertable.cpp     Mon Dec 23 14:55:20 2019 +0100
+++ b/usertable.cpp     Mon Dec 23 14:58:58 2019 +0100
@@ -437,7 +437,7 @@
         }
         else if (cs[px] == '&') {     // numeric mask
           char* s;
-#pragma GCC diagnostic ignored "-Wunused-result"  
+#pragma GCC diagnostic ignored "-Wunused-result"
           asprintf(&s, "%u", (unsigned) rEvt.GetMask());
 #pragma GCC diagnostic warning "-Wunused-result"
           cmd.append(s);
@@ -460,7 +460,7 @@
     syslog(LOG_INFO, "(system::%s) CMD (%s)", m_user.c_str(), cmd.c_str());
   else
     syslog(LOG_INFO, "(%s) CMD (%s)", m_user.c_str(), cmd.c_str());
-    
+
 #ifdef LOOPER
   if (pE->IsNoLoop())
     pW->SetEnabled(false);
@@ -485,6 +485,7 @@
                pW->SetEnabled(true);
 #endif
     }
+    _exit(0);
   }
   else if (pid > 0) {
 #ifdef LOOPER

@landryb
Copy link

landryb commented Sep 28, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants