Generally we prefer 'return' from main() over exit() so that automatic
cleanups and such work correct. Let's do that in shutdown.c too, becuase
there's not really any reason not to.
With this we are pretty good in consistently using return from main()
rather than exit() all across the codebase. Yay!
if (streq(arg_verb, "exit")) {
if (in_container)
- exit(arg_exit_code);
- else {
- /* We cannot exit() on the host, fallback on another
- * method. */
- cmd = RB_POWER_OFF;
- }
+ return arg_exit_code;
+
+ cmd = RB_POWER_OFF; /* We cannot exit() on the host, fallback on another method. */
}
switch (cmd) {
* CAP_SYS_BOOT just exit, this will kill our
* container for good. */
log_info("Exiting container.");
- exit(EXIT_SUCCESS);
+ return EXIT_SUCCESS;
}
r = log_error_errno(errno, "Failed to invoke reboot(): %m");