]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
basic/util: silence stupid gcc warnings about unitialized variable
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 9 Apr 2016 02:20:22 +0000 (22:20 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 13 Apr 2016 12:56:44 +0000 (08:56 -0400)
src/basic/util.c
src/core/machine-id-setup.c
src/core/unit.c

index 957b0e1ff1878d0bef3d712f648f96c11fc90f25..b70c50047fb7c3d641f1d1b697174ca5e9155716 100644 (file)
@@ -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;
 }
index 86da16c31e50193564481539833976f117b45497..9de528b6cfa1169ec2193bf38e8df27cc0758b12 100644 (file)
@@ -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 */
index fb88260d2301c6e23c46ec940752345e9ef88866..49c990c2d7ded50d4f7a83b41c6b9121d0bb63e0 100644 (file)
@@ -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)