Actually set the umask.

This commit is contained in:
Roy Marples 2008-08-20 10:19:03 +00:00
parent 1ab1e9328a
commit fabee4dc2d

View File

@ -603,6 +603,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; mode_t numask;
TAILQ_INIT(&schedule); TAILQ_INIT(&schedule);
@ -703,6 +704,7 @@ 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 */
@ -929,6 +931,8 @@ 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);
#ifdef TIOCNOTTY #ifdef TIOCNOTTY
tty_fd = open("/dev/tty", O_RDWR); tty_fd = open("/dev/tty", O_RDWR);