diff options
Diffstat (limited to 'src/core/main.c')
-rw-r--r-- | src/core/main.c | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/src/core/main.c b/src/core/main.c index 9aaf244e71..be95dc68b2 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -918,8 +918,7 @@ static int parse_argv(int argc, char *argv[]) { if (!f) return log_error_errno(errno, "Failed to open serialization fd: %m"); - if (arg_serialization) - fclose(arg_serialization); + safe_fclose(arg_serialization); arg_serialization = f; @@ -1059,8 +1058,7 @@ static int prepare_reexecute(Manager *m, FILE **_f, FDSet **_fds, bool switching fail: fdset_free(fds); - if (f) - fclose(f); + safe_fclose(f); return r; } @@ -1118,9 +1116,10 @@ static void test_mtab(void) { if (r >= 0 && nulstr_contains(ok, p)) return; - log_warning("/etc/mtab is not a symlink or not pointing to /proc/self/mounts. " - "This is not supported anymore. " - "Please make sure to replace this file by a symlink to avoid incorrect or misleading mount(8) output."); + log_error("/etc/mtab is not a symlink or not pointing to /proc/self/mounts. " + "This is not supported anymore. " + "Please make sure to replace this file by a symlink to avoid incorrect or misleading mount(8) output."); + freeze(); } static void test_usr(void) { @@ -1678,10 +1677,7 @@ int main(int argc, char *argv[]) { fdset_free(fds); fds = NULL; - if (arg_serialization) { - fclose(arg_serialization); - arg_serialization = NULL; - } + arg_serialization = safe_fclose(arg_serialization); if (queue_default_job) { _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; @@ -1841,9 +1837,8 @@ finish: arg_shutdown_watchdog = m->shutdown_watchdog; m = manager_free(m); - for (j = 0; j < ELEMENTSOF(arg_default_rlimit); j++) { + for (j = 0; j < ELEMENTSOF(arg_default_rlimit); j++) arg_default_rlimit[j] = mfree(arg_default_rlimit[j]); - } arg_default_unit = mfree(arg_default_unit); @@ -1923,10 +1918,7 @@ finish: * getopt() in argv[], and some cleanups in envp[], * but let's hope that doesn't matter.) */ - if (arg_serialization) { - fclose(arg_serialization); - arg_serialization = NULL; - } + arg_serialization = safe_fclose(arg_serialization); if (fds) { fdset_free(fds); @@ -1966,10 +1958,7 @@ finish: log_warning_errno(errno, "Failed to execute /sbin/init, giving up: %m"); } - if (arg_serialization) { - fclose(arg_serialization); - arg_serialization = NULL; - } + arg_serialization = safe_fclose(arg_serialization); if (fds) { fdset_free(fds); |