summaryrefslogtreecommitdiff
path: root/src/core/machine-id-setup.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-04-07 16:15:26 +0200
committerLennart Poettering <lennart@poettering.net>2016-04-12 13:43:32 +0200
commit8612da973d30c5a9530fa1b6b3d449147b5a3324 (patch)
tree391c71ae6c9bd01e69ed98e39b8cbc72e3f07572 /src/core/machine-id-setup.c
parent4f4afc88ecd8ab9cfe9e1eeea7e3aeb937811937 (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/core/machine-id-setup.c')
-rw-r--r--src/core/machine-id-setup.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/core/machine-id-setup.c b/src/core/machine-id-setup.c
index 7b25349c07..86da16c31e 100644
--- a/src/core/machine-id-setup.c
+++ b/src/core/machine-id-setup.c
@@ -259,9 +259,8 @@ int machine_id_setup(const char *root, sd_id128_t machine_id) {
/* Hmm, we couldn't write it? So let's write it to
* /run/machine-id as a replacement */
- RUN_WITH_UMASK(0022) {
+ RUN_WITH_UMASK(0022)
r = write_string_file(run_machine_id, id, WRITE_STRING_FILE_CREATE);
- }
if (r < 0) {
(void) unlink(run_machine_id);
return log_error_errno(r, "Cannot write %s: %m", run_machine_id);