diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-04-07 16:15:26 +0200 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2017-06-16 10:12:57 +0200 |
commit | 13e2b6689d7729cf201e4f2ac43278f11c811bc8 (patch) | |
tree | 09dd071c26dc132b3bd361f38661352bfd85c262 /src/basic/util.c | |
parent | f446ee404a6f2b58dbbf1c065595bd9c1daaf027 (diff) |
core: be more paranoid when mixing umask and fopen()
Let's be extra careful with the umask when we use simple fopen(), as this
creates files with 0777 by default.
Diffstat (limited to 'src/basic/util.c')
-rw-r--r-- | src/basic/util.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/basic/util.c b/src/basic/util.c index 8f2317f28..b049a4485 100644 --- a/src/basic/util.c +++ b/src/basic/util.c @@ -55,6 +55,7 @@ #include "string-util.h" #include "strv.h" #include "time-util.h" +#include "umask-util.h" #include "user-util.h" #include "util.h" @@ -784,7 +785,8 @@ int update_reboot_param_file(const char *param) { int r = 0; if (param) { - r = write_string_file(REBOOT_PARAM_FILE, param, WRITE_STRING_FILE_CREATE); + RUN_WITH_UMASK(0022) + r = write_string_file(REBOOT_PARAM_FILE, param, WRITE_STRING_FILE_CREATE); if (r < 0) return log_error_errno(r, "Failed to write reboot param to "REBOOT_PARAM_FILE": %m"); } else |