[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [lvm-devel] [PATCH] dmeventd: don't kill the parent if not forking

funny :)


On Mar 18, 2010, at 6:23 PM, Mikulas Patocka wrote:

Don't kill the parent if debugging and not forking.

If dmeventd runs with -d flag, it doesn't fork into backgroud.
The command kill(getppid(), SIGTERM) attempts to kill the parent dmeventd process, however, if there is no parent, it kills whatever process spawned
dmeventd. In case of debugging with gdb, the parent is gdb, thus
kill(getppid(), SIGTERM) kills the debugger.

Signed-off-by: Mikulas Patocka <mpatocka redhat com>

daemons/dmeventd/dmeventd.c |    3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Index: LVM2/daemons/dmeventd/dmeventd.c
--- LVM2.orig/daemons/dmeventd/dmeventd.c 2010-03-19 00:12:00.000000000 +0100 +++ LVM2/daemons/dmeventd/dmeventd.c 2010-03-19 00:13:15.000000000 +0100
@@ -1734,7 +1734,8 @@ int main(int argc, char *argv[])

	/* Signal parent, letting them know we are ready to go. */
-	kill(getppid(), SIGTERM);
+	if (!_debug)
+		kill(getppid(), SIGTERM);
	syslog(LOG_NOTICE, "dmeventd ready for processing.");

	while (!_exit_now) {

lvm-devel mailing list
lvm-devel redhat com

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]