basic/util: silence stupid gcc warnings about unitialized variable

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2016-04-08 22:20:22 -04:00
parent 025ef1d226
commit 78e334b50f
3 changed files with 14 additions and 11 deletions

View file

@ -792,10 +792,11 @@ int update_reboot_parameter_and_warn(const char *param) {
return 0; return 0;
} }
RUN_WITH_UMASK(0022) RUN_WITH_UMASK(0022) {
r = write_string_file("/run/systemd/reboot-param", param, WRITE_STRING_FILE_CREATE); r = write_string_file("/run/systemd/reboot-param", param, WRITE_STRING_FILE_CREATE);
if (r < 0) if (r < 0)
return log_warning_errno(r, "Failed to write reboot parameter file: %m"); return log_warning_errno(r, "Failed to write reboot parameter file: %m");
}
return 0; return 0;
} }

View 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 /* Hmm, we couldn't write it? So let's write it to
* /run/machine-id as a replacement */ * /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); r = write_string_file(run_machine_id, id, WRITE_STRING_FILE_CREATE);
if (r < 0) { if (r < 0) {
(void) unlink(run_machine_id); (void) unlink(run_machine_id);
return log_error_errno(r, "Cannot write %s: %m", run_machine_id); return log_error_errno(r, "Cannot write %s: %m", run_machine_id);
}
} }
/* And now, let's mount it over */ /* And now, let's mount it over */

View 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 /* 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. */ * 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"); f = fopen(path, "we");
if (!f) { if (!f) {
free(path); free(path);
return -errno; return -errno;
}
} }
if (u->transient_file) if (u->transient_file)