X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fmain.c;h=02b7c37f8dcd8d85c4326ccaf731dfbffdbaeade;hb=63c372cb9df3bee01e3bf8cd7f96f336bddda846;hp=5cdd20aef8685fa863812cab1fc82f2455d6d8e0;hpb=df6e44c4affced590b0d19c594d9301ffd436591;p=elogind.git diff --git a/src/core/main.c b/src/core/main.c index 5cdd20aef..02b7c37f8 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -1829,7 +1829,8 @@ int main(int argc, char *argv[]) { finish: pager_close(); - arg_shutdown_watchdog = m->shutdown_watchdog; + if (m) + arg_shutdown_watchdog = m->shutdown_watchdog; m = manager_free(m); for (j = 0; j < ELEMENTSOF(arg_default_rlimit); j++) { @@ -1882,7 +1883,7 @@ finish: args = newa(const char*, args_size); if (!switch_root_init) { - char sfd[16]; + char sfd[DECIMAL_STR_MAX(int) + 1]; /* First try to spawn ourselves with the right * path, and with full serialization. We do @@ -1892,8 +1893,7 @@ finish: assert(arg_serialization); assert(fds); - snprintf(sfd, sizeof(sfd), "%i", fileno(arg_serialization)); - char_array_0(sfd); + xsprintf(sfd, "%i", fileno(arg_serialization)); i = 0; args[i++] = SYSTEMD_BINARY_PATH; @@ -1994,7 +1994,7 @@ finish: assert(command_line[pos] == NULL); env_block = strv_copy(environ); - snprintf(log_level, sizeof(log_level), "%d", log_get_max_level()); + xsprintf(log_level, "%d", log_get_max_level()); switch (log_get_target()) { case LOG_TARGET_KMSG: