mirror of
git://git.suckless.org/sbase
synced 2024-12-21 22:50:16 +00:00
nohup: Open nohup.out WRONLY
Open nohup.out write-only instead of not specifying the access permissions instead of getting undefined behavior (which probably results in stdout not being writable).
This commit is contained in:
parent
371f3cb5ec
commit
2c2a7f54ab
2
nohup.c
2
nohup.c
@ -31,7 +31,7 @@ main(int argc, char *argv[])
|
||||
enprintf(127, "signal HUP:");
|
||||
|
||||
if (isatty(STDOUT_FILENO)) {
|
||||
if ((fd = open("nohup.out", O_APPEND | O_CREAT, S_IRUSR | S_IWUSR)) < 0)
|
||||
if ((fd = open("nohup.out", O_WRONLY | O_APPEND | O_CREAT, S_IRUSR | S_IWUSR)) < 0)
|
||||
enprintf(127, "open nohup.out:");
|
||||
if (dup2(fd, STDOUT_FILENO) < 0)
|
||||
enprintf(127, "dup2:");
|
||||
|
Loading…
Reference in New Issue
Block a user