From 78e334b50f12a3ef386fb5de03d0549fa853c692 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Fri, 8 Apr 2016 22:20:22 -0400 Subject: basic/util: silence stupid gcc warnings about unitialized variable --- src/basic/util.c | 7 ++++--- src/core/machine-id-setup.c | 9 +++++---- src/core/unit.c | 9 +++++---- 3 files changed, 14 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/basic/util.c b/src/basic/util.c index 957b0e1ff1..b70c50047f 100644 --- a/src/basic/util.c +++ b/src/basic/util.c @@ -792,10 +792,11 @@ int update_reboot_parameter_and_warn(const char *param) { return 0; } - RUN_WITH_UMASK(0022) + RUN_WITH_UMASK(0022) { r = write_string_file("/run/systemd/reboot-param", param, WRITE_STRING_FILE_CREATE); - if (r < 0) - return log_warning_errno(r, "Failed to write reboot parameter file: %m"); + if (r < 0) + return log_warning_errno(r, "Failed to write reboot parameter file: %m"); + } return 0; } diff --git a/src/core/machine-id-setup.c b/src/core/machine-id-setup.c index 86da16c31e..9de528b6cf 100644 --- a/src/core/machine-id-setup.c +++ b/src/core/machine-id-setup.c @@ -259,11 +259,12 @@ 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); + if (r < 0) { + (void) unlink(run_machine_id); + return log_error_errno(r, "Cannot write %s: %m", run_machine_id); + } } /* And now, let's mount it over */ diff --git a/src/core/unit.c b/src/core/unit.c index fb88260d23..49c990c2d7 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -3480,11 +3480,12 @@ int unit_make_transient(Unit *u) { /* Let's open the file we'll write the transient settings into. This file is kept open as long as we are * creating the transient, and is closed in unit_load(), as soon as we start loading the file. */ - RUN_WITH_UMASK(0022) + RUN_WITH_UMASK(0022) { f = fopen(path, "we"); - if (!f) { - free(path); - return -errno; + if (!f) { + free(path); + return -errno; + } } if (u->transient_file) -- cgit v1.2.3-54-g00ecf