Open mokraemer opened 4 years ago
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
potential fix in #56, same issue as #52 ? also see https://bugzilla.redhat.com/show_bug.cgi?id=1656939 & https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=930526
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