From 92a217d0be3dd3f19eeb8dfd883d9ce4bfed7366 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 19 May 2014 19:48:55 +0200 Subject: m + add --alarm= options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-base.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/mds-base.c') diff --git a/src/mds-base.c b/src/mds-base.c index 433564e..ede29c3 100644 --- a/src/mds-base.c +++ b/src/mds-base.c @@ -49,6 +49,10 @@ int socket_fd = -1; */ static int parse_cmdline(void) { +#if (LIBEXEC_ARGC_EXTRA_LIMIT < 2) +# error LIBEXEC_ARGC_EXTRA_LIMIT is too small, need at least 2. +#endif + int i; for (i = 1; i < argc; i++) { @@ -64,6 +68,8 @@ static int parse_cmdline(void) } else if (strequals(arg, "--re-exec")) /* Re-exec state-marshal. */ is_reexec = 1; + else if (startswith(arg, "--alarm=")) /* Schedule an alarm signal for forced abort. */ + alarm((unsigned)min(atoi(arg + strlen("--alarm=")), 60)); /* At most 1 minute. */ } if (is_reexec) { @@ -117,10 +123,6 @@ int main(int argc_, char** argv_) { int r; -#if (LIBEXEC_ARGC_EXTRA_LIMIT < 2) -# error LIBEXEC_ARGC_EXTRA_LIMIT is too small, need at least 2. -#endif - argc = argc_; argv = argv_; -- cgit v1.2.3-70-g09d2