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

Bug#157305: start-stop-daemon: spurious error message when using --pidfile and --retry together



     Hi,

Loic Minier <lool@dooz.org> - Sat, Aug 28, 2004:

>  A check is missing in ssd when the process is only pointed by its pid,
>  ssd doesn't check that the pid is running.  The attached patch fixes
>  this problem.

 Sorry, I foolishly did not test my patch extensively.  Attached is an
 updated patch for start-stop-daemon.c (same place).

 A small discussion of the problem it solves in the source:
 check(pid_t pid) is a kind of "grep" function augmenting a linked list
 of found pids when a pid matches the search patterns passed to ssd.
   For example if --exec is passed, ssd will look wether /proc/pid/cmd
 points to the argument of exec.
   Now the problem is that once a pid is in the linked list, ssd thinks
 it might do some useful things with it.  For example, call kill() on
 that pid.
   There was already a check, only used in the case of "ssd --start",
 wether or not the pid is running (if (start && !pid_is_running(pid)),
 don't add the pid to the linked list).
   Now my patch adds a check in the case of "ssd --stop", I simply
 removed the "start" check (that gives if (!pid_is_running(pid)) don't
 add the pid to the linked list).
   I think this is ok, because ssd might only be called with --start,
 --stop, --help, or --version, the last 2 flags making ssd exit
 immediately.

 I did test ssd against what I've understood of what its normal behavior
 should be, and my system starts and stops fine with the pacthed
 version.  I'd appreciate a proof-reading though.

>  A temporary workaround is to use --name or --exec in the
>  start-stop-daemon command line.

 This still holds true.

     Regards,

-- 
Loïc Minier <lool@dooz.org>
--- dpkg-1.10.23-orig/utils/start-stop-daemon.c	2004-07-19 20:56:49.000000000 +0200
+++ dpkg-1.10.23/utils/start-stop-daemon.c	2004-08-29 13:34:25.000000000 +0200
@@ -732,7 +732,7 @@
 		return;
 	if (cmdname && !pid_is_cmd(pid, cmdname))
 		return;
-	if (start && !pid_is_running(pid))
+	if (!pid_is_running(pid))
 		return;
 	push(&found, pid);
 }

Reply to: