Fix unmask option, thanks to douglas@openplans.org, #146

This commit is contained in:
Roy Marples 2009-02-10 23:11:17 +00:00
parent 3fc17f5966
commit 069590d97f

View File

@ -653,8 +653,7 @@ int start_stop_daemon(int argc, char **argv)
char line[130]; char line[130];
FILE *fp; FILE *fp;
size_t len; size_t len;
bool setumask = false; mode_t numask = 022;
mode_t numask;
char **margv; char **margv;
unsigned int start_wait = 0; unsigned int start_wait = 0;
@ -775,7 +774,6 @@ int start_stop_daemon(int argc, char **argv)
if (parse_mode(&numask, optarg)) if (parse_mode(&numask, optarg))
eerrorx("%s: invalid mode `%s'", eerrorx("%s: invalid mode `%s'",
applet, optarg); applet, optarg);
setumask = true;
break; break;
case 'm': /* --make-pidfile */ case 'm': /* --make-pidfile */
@ -1041,8 +1039,7 @@ int start_stop_daemon(int argc, char **argv)
/* Child process - lets go! */ /* Child process - lets go! */
if (pid == 0) { if (pid == 0) {
pid_t mypid = getpid(); pid_t mypid = getpid();
if (setumask) umask(numask);
umask(numask);
#ifdef TIOCNOTTY #ifdef TIOCNOTTY
tty_fd = open("/dev/tty", O_RDWR); tty_fd = open("/dev/tty", O_RDWR);
@ -1161,8 +1158,6 @@ int start_stop_daemon(int argc, char **argv)
setenv("PATH", newpath, 1); setenv("PATH", newpath, 1);
} }
umask(022);
stdout_fd = devnull_fd; stdout_fd = devnull_fd;
stderr_fd = devnull_fd; stderr_fd = devnull_fd;
if (redirect_stdout) { if (redirect_stdout) {