Skip to content

Commit

Permalink
shutdown: Select respective action on soft-reboot utility (#381)
Browse files Browse the repository at this point in the history
Signed-off-by: Mobin Aydinfar <[email protected]>
  • Loading branch information
mobin-2008 authored Sep 21, 2024
1 parent 17cf6b0 commit f433d81
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/shutdown.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ static constexpr uint16_t min_cp_version = 1;
static constexpr uint16_t max_cp_version = 1;

static constexpr auto reboot_execname = cts::literal(SHUTDOWN_PREFIX) + cts::literal("reboot");
static constexpr auto soft_reboot_execname = cts::literal(SHUTDOWN_PREFIX) + cts::literal("soft-reboot");

using loop_t = dasynq::event_loop_n;
using rearm = dasynq::rearm;
Expand Down Expand Up @@ -260,6 +261,9 @@ int main(int argc, char **argv)
if (strcmp(execname, reboot_execname) == 0) {
shutdown_type = shutdown_type_t::REBOOT;
}
else if (strcmp(execname, soft_reboot_execname) == 0) {
shutdown_type = shutdown_type_t::SOFTREBOOT;
}

for (int i = 1; i < argc; i++) {
if (argv[i][0] == '-') {
Expand Down Expand Up @@ -390,7 +394,7 @@ int main(int argc, char **argv)
cerr << "shutdown: control socket write error: " << std::strerror(e.errcode) << endl;
return 1;
}

while (true) {
pause();
}
Expand Down

0 comments on commit f433d81

Please sign in to comment.