}
// Fork and execute dinit-reboot.
- const char *shutdown_exec = literal(SBINDIR) + "/shutdown";
- execl(shutdown_exec, shutdown_exec, "--system", cmd_arg, nullptr);
- log(loglevel_t::ERROR, literal("Could not execute ") + SBINDIR + "/shutdown: ", strerror(errno));
+ constexpr auto shutdown_exec = literal(SBINDIR) + "/shutdown";
+ execl(shutdown_exec.c_str(), shutdown_exec.c_str(), "--system", cmd_arg, nullptr);
+ log(loglevel_t::ERROR, (literal("Could not execute ") + SBINDIR + "/shutdown: ").c_str(),
+ strerror(errno));
// PID 1 must not actually exit, although we should never reach this point:
while (true) {
// basically use it anyway.
try {
setup_main_log(sockfd);
+ external_log_open = true;
}
catch (std::exception &e) {
log(loglevel_t::ERROR, "Setting up log failed: ", e.what());
if (log_fd >= 0) {
try {
setup_main_log(log_fd);
+ external_log_open = true;
}
catch (std::exception &e) {
log(loglevel_t::ERROR, "Setting up log failed: ", e.what());
{
// This performs an immediate shutdown, without service rollback.
close_control_socket();
- const char *shutdown_exec = literal(SBINDIR) + "/shutdown";
- execl(shutdown_exec, shutdown_exec, "--system", (char *) 0);
+ constexpr auto shutdown_exec = literal(SBINDIR) + "/shutdown";
+ execl(shutdown_exec.c_str(), shutdown_exec.c_str(), "--system", (char *) 0);
log(loglevel_t::ERROR, literal("Error executing ") + SBINDIR + "/sbin/shutdown: ", strerror(errno));
sync(); // since a hard poweroff might be required at this point...
}