diff options
author | Roy Marples <roy@marples.name> | 2008-12-28 14:05:33 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2008-12-28 14:05:33 +0000 |
commit | f4b836694227824754f8e556680b49bfd70c49d9 (patch) | |
tree | 846bf9dab28e7aef8383aff33a40e2396fbfc124 | |
parent | 438665357b434b3d271ce2712fb1c5122c330d0f (diff) |
Parse retry schedule correctly, #129. Thanks to vaeth.
-rw-r--r-- | src/rc/start-stop-daemon.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c index 739e87d9..da29e275 100644 --- a/src/rc/start-stop-daemon.c +++ b/src/rc/start-stop-daemon.c @@ -626,6 +626,7 @@ int start_stop_daemon(int argc, char **argv) char *startas = NULL; char *name = NULL; char *pidfile = NULL; + char *retry = NULL; int sig = 0; int nicelevel = 0; bool background = false; @@ -694,7 +695,7 @@ int start_stop_daemon(int argc, char **argv) break; case 'R': /* --retry <schedule>|<timeout> */ - parse_schedule(optarg, sig); + retry = optarg; break; case 'S': /* --start */ @@ -853,7 +854,9 @@ int start_stop_daemon(int argc, char **argv) else if (exec) *--argv = exec; - if (stop || sig) { + if (stop || sig != 0) { + if (sig == 0) + sig = SIGTERM; if (!*argv && !pidfile && !name && !uid) eerrorx("%s: --stop needs --exec, --pidfile," " --name or --user", applet); @@ -876,6 +879,7 @@ int start_stop_daemon(int argc, char **argv) eerrorx("%s: --stdout and --stderr are only relevant" " with --background", applet); } + /* Expand ~ */ if (ch_dir && *ch_dir == '~') ch_dir = expand_home(home, ch_dir); @@ -955,16 +959,16 @@ int start_stop_daemon(int argc, char **argv) margv = nav ? nav : argv; if (stop || sig) { - if (!sig) + if (sig == 0) sig = SIGTERM; if (!stop) oknodo = true; - if (!TAILQ_FIRST(&schedule)) { - if (test || oknodo) - parse_schedule("0", sig); - else - parse_schedule(NULL, sig); - } + if (retry) + parse_schedule(retry, sig); + else if (test || oknodo) + parse_schedule("0", sig); + else + parse_schedule(NULL, sig); i = run_stop_schedule(exec, (const char *const *)margv, pidfile, uid, quiet, verbose, test); |