From 0cf6a2dbcd58511a775c031112e25ecf3b5b5b5b Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 11 Jun 2014 22:43:54 -0500 Subject: Option parsing for nohup needs to stop at first nonoption argument. Minor cleanups. --- toys/posix/nohup.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'toys/posix/nohup.c') diff --git a/toys/posix/nohup.c b/toys/posix/nohup.c index 42d0e116..0cece0b5 100644 --- a/toys/posix/nohup.c +++ b/toys/posix/nohup.c @@ -4,7 +4,7 @@ * * See http://opengroup.org/onlinepubs/9699919799/utilities/nohup.html -USE_NOHUP(NEWTOY(nohup, "<1", TOYFLAG_USR|TOYFLAG_BIN)) +USE_NOHUP(NEWTOY(nohup, "<1^", TOYFLAG_USR|TOYFLAG_BIN)) config NOHUP bool "nohup" @@ -13,8 +13,8 @@ config NOHUP usage: nohup COMMAND [ARGS...] Run a command that survives the end of its terminal. - If stdin is a tty, redirect from /dev/null - If stdout is a tty, redirect to file "nohup.out" + + Redirect tty on stdin to /dev/null, tty on stdout to "nohup.out". */ #include "toys.h" @@ -29,7 +29,7 @@ void nohup_main(void) { char *temp = getenv("HOME"); temp = xmprintf("%s/%s", temp ? temp : "", "nohup.out"); - xcreate(temp, O_CREAT|O_APPEND|O_WRONLY, S_IRUSR|S_IWUSR); + xcreate(temp, O_CREAT|O_APPEND|O_WRONLY, 0600); } } if (isatty(0)) { -- cgit v1.2.3