Use sys/stat.h defines instead of bare octal values.

This commit is contained in:
Todd C. Miller
2016-11-07 13:36:05 -07:00
parent 2b020c9f17
commit 8133cdfdf6
12 changed files with 43 additions and 23 deletions

View File

@@ -364,7 +364,8 @@ fix_fds(void)
miss[STDOUT_FILENO] = fcntl(STDOUT_FILENO, F_GETFL, 0) == -1;
miss[STDERR_FILENO] = fcntl(STDERR_FILENO, F_GETFL, 0) == -1;
if (miss[STDIN_FILENO] || miss[STDOUT_FILENO] || miss[STDERR_FILENO]) {
if ((devnull = open(_PATH_DEVNULL, O_RDWR, 0644)) == -1)
devnull = open(_PATH_DEVNULL, O_RDWR, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
if (devnull == -1)
sudo_fatal(U_("unable to open %s"), _PATH_DEVNULL);
if (miss[STDIN_FILENO] && dup2(devnull, STDIN_FILENO) == -1)
sudo_fatal("dup2");