aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2020-06-25 22:52:07 +0300
committerSergey Poznyakoff <gray@gnu.org>2020-06-25 22:52:07 +0300
commit51a1de1eb5e8606a1788eed62a5d8f15922cb816 (patch)
treeed49670793133a0472bc1e9c5b7d1294ff92e3c7
parent7418f43e537a4b7f2563a9adb4bf467ff1a9b2a3 (diff)
downloadmicron-51a1de1eb5e8606a1788eed62a5d8f15922cb816.tar.gz
micron-51a1de1eb5e8606a1788eed62a5d8f15922cb816.tar.bz2
Inherit umask from the shell.v0.8
* src/micrond.c (saved_umask): New global. (main): Save current umask value in saved_umask. * src/runner.c (runner_start): Set umask from saved_umask.
-rw-r--r--src/micrond.c4
-rw-r--r--src/micrond.h1
-rw-r--r--src/runner.c2
3 files changed, 4 insertions, 3 deletions
diff --git a/src/micrond.c b/src/micrond.c
index 16edc22..af65141 100644
--- a/src/micrond.c
+++ b/src/micrond.c
@@ -124,6 +124,7 @@ int foreground;
int no_safety_checking;
char *mailer_command = "/usr/sbin/sendmail -oi -t";
int log_level = LOG_INFO;
+mode_t saved_umask;
/* Boolean flag used to filter out @reboot jobs when rescanning. */
static int running;
@@ -348,8 +349,7 @@ main(int argc, char **argv)
} else if (micron_options.syslog_facility)
micron_log_open(progname, LOG_CRON);
- umask(077);
-
+ saved_umask = umask(077);
crongroups_parse_all(PARSE_ALWAYS);
sigemptyset(&sigs);
diff --git a/src/micrond.h b/src/micrond.h
index bd25600..fb9ec5e 100644
--- a/src/micrond.h
+++ b/src/micrond.h
@@ -175,6 +175,7 @@ struct crongroup {
extern struct list_head crongroup_head;
extern char *mailer_command;
extern int log_level;
+extern mode_t saved_umask;
/* Return values from crontab safety checking and parsing functions */
enum {
diff --git a/src/runner.c b/src/runner.c
index 99e5545..f13d9e2 100644
--- a/src/runner.c
+++ b/src/runner.c
@@ -255,7 +255,7 @@ runner_start(struct cronjob *job)
char const *shell;
/* Set the proper umask */
- umask(022);
+ umask(saved_umask);
/* Redirect stdout and stderr to file */
dup2(fd, 1);

Return to:

Send suggestions and report system problems to the System administrator.