diff options
author | Christian Ruppert <idl0r@gentoo.org> | 2012-09-12 21:00:20 +0200 |
---|---|---|
committer | Christian Ruppert <idl0r@gentoo.org> | 2012-09-12 21:00:20 +0200 |
commit | a06072b3959adc91ddf5157f69162977cbd48079 (patch) | |
tree | ccf0c75d21368237871f44b23f553c10400a6c09 /src/rc/start-stop-daemon.c | |
parent | 3863c11be5d48ad4d1a10156f474339bea04f5ae (diff) |
Silence get_pid(), OpenRC will give the process some time to create the PID file and the first get__pid() call may fail.
Diffstat (limited to 'src/rc/start-stop-daemon.c')
-rw-r--r-- | src/rc/start-stop-daemon.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c index a3d887ac..7c24eadd 100644 --- a/src/rc/start-stop-daemon.c +++ b/src/rc/start-stop-daemon.c @@ -305,7 +305,7 @@ parse_schedule(const char *string, int timeout) } static pid_t -get_pid(const char *pidfile) +get_pid(const char *pidfile, bool quiet) { FILE *fp; pid_t pid; @@ -314,12 +314,14 @@ get_pid(const char *pidfile) return -1; if ((fp = fopen(pidfile, "r")) == NULL) { - eerror("%s: fopen `%s': %s", applet, pidfile, strerror(errno)); + if(!quiet) + eerror("%s: fopen `%s': %s", applet, pidfile, strerror(errno)); return -1; } if (fscanf(fp, "%d", &pid) != 1) { - eerror("%s: no pid found in `%s'", applet, pidfile); + if(!quiet) + eerror("%s: no pid found in `%s'", applet, pidfile); fclose(fp); return -1; } @@ -413,7 +415,7 @@ run_stop_schedule(const char *exec, const char *const *argv, } if (pidfile) { - pid = get_pid(pidfile); + pid = get_pid(pidfile, false); if (pid == -1) return 0; } @@ -1079,7 +1081,7 @@ start_stop_daemon(int argc, char **argv) } if (pidfile) - pid = get_pid(pidfile); + pid = get_pid(pidfile, false); else pid = 0; @@ -1352,7 +1354,7 @@ start_stop_daemon(int argc, char **argv) alive = true; } else { if (pidfile) { - pid = get_pid(pidfile); + pid = get_pid(pidfile, true); if (pid == -1) { eerrorx("%s: did not " "create a valid" |