From c96a0157424f8f7829a1c1b2f4f365f436159636 Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Sun, 11 Oct 2009 13:22:46 -0500 Subject: fix wait time for gentoo bug 288495 The wait time was in seconds. This patch converts it to milliseconds. --- man/start-stop-daemon.8 | 6 +++--- src/rc/start-stop-daemon.c | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/man/start-stop-daemon.8 b/man/start-stop-daemon.8 index 0175584..be51152 100644 --- a/man/start-stop-daemon.8 +++ b/man/start-stop-daemon.8 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd September 4, 2009 +.Dd October 14, 2009 .Dt START-STOP-DAEMON 8 SMM .Os OpenRC .Sh NAME @@ -144,9 +144,9 @@ Redirect the standard output of the process to logfile when started with Must be an absolute pathname, but relative to the path optionally given with .Fl r , -chroot . The logfile can also be a named pipe. -.It Fl w , -wait Ar seconds +.It Fl w , -wait Ar milliseconds Wait -.Ar seconds +.Ar milliseconds after starting and check that daemon is still running. Useful for daemons that check configuration after forking or stopping race conditions where the pidfile is written out after forking. diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c index d0ee93a..9f7af9b 100644 --- a/src/rc/start-stop-daemon.c +++ b/src/rc/start-stop-daemon.c @@ -37,6 +37,7 @@ #define POLL_INTERVAL 20000000 #define WAIT_PIDFILE 500000000 #define ONE_SECOND 1000000000 +#define ONE_MS 1000000 #include #include @@ -638,7 +639,7 @@ static const char * const longopts_help[] = { "Test actions, don't do them", "Change the process user", "Chroot to this directory", - "Seconds to wait for daemon start", + "Milliseconds to wait for daemon start", "Binary to start/stop", "Redirect stdout to file", "Redirect stderr to file", @@ -1311,8 +1312,8 @@ start_stop_daemon(int argc, char **argv) struct timespec ts; bool alive = false; - ts.tv_sec = start_wait; - ts.tv_nsec = 0; + ts.tv_sec = start_wait / 1000; + ts.tv_nsec = (start_wait % 1000) * ONE_MS; if (nanosleep(&ts, NULL) == -1) { if (errno == EINTR) eerror("%s: caught an interrupt", applet); -- cgit v1.2.3