Pádraig Brady <[email protected]> writes: > We restore the original umask before the exec, > so this umask() is only ensuring u+rw aren't set in the umask > so that we create nohup.out with u+rw. > The simplest way to do that I think is just clearing the umask: > > index d58fcc53f..6218986cb 100644 > --- a/src/nohup.c > +++ b/src/nohup.c > @@ -141,7 +141,7 @@ main (int argc, char **argv) > char const *file = "nohup.out"; > int flags = O_CREAT | O_WRONLY | O_APPEND; > mode_t mode = S_IRUSR | S_IWUSR; > - mode_t umask_value = umask (~mode); > + mode_t umask_value = umask (0); > out_fd = (redirecting_stdout > ? fd_reopen (STDOUT_FILENO, file, flags, mode) > : open (file, flags, mode));
That rational sounds good to me. Since the umask is only set for the current process and it is restored before we do exec, setting it to 0 is fine. Grisha and I were overthinking it a bit, I think. :) Collin
