mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-10-27 14:31:33 +01:00
46 lines
1.5 KiB
Diff
46 lines
1.5 KiB
Diff
From 213d3fb1bff820f9cbe981193ad06c103d787405 Mon Sep 17 00:00:00 2001
|
|
From: Mobin Aydinfar <mobin@mobintestserver.ir>
|
|
Date: Sat, 18 May 2024 13:58:46 +0330
|
|
Subject: [PATCH] shutdown: Respect "SHUTDOWN_PREFIX" for reboot util check
|
|
|
|
It was a bug that shutdown executable only checked "reboot" string to find out
|
|
this should be a reboot or normal shutdown.
|
|
|
|
Regression: It's not, because it was broken from the beginning.
|
|
|
|
Signed-off-by: Mobin Aydinfar <mobin@mobintestserver.ir>
|
|
---
|
|
src/shutdown.cc | 5 ++++-
|
|
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/shutdown.cc b/src/shutdown.cc
|
|
index 7e25c9e5..24c6375f 100644
|
|
--- a/src/shutdown.cc
|
|
+++ b/src/shutdown.cc
|
|
@@ -18,6 +18,7 @@
|
|
#include "cpbuffer.h"
|
|
#include "control-cmds.h"
|
|
#include "service-constants.h"
|
|
+#include "static-string.h"
|
|
#include "dinit-client.h"
|
|
#include "dinit-util.h"
|
|
#include "mconfig.h"
|
|
@@ -31,6 +32,8 @@
|
|
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");
|
|
+
|
|
using loop_t = dasynq::event_loop_n;
|
|
using rearm = dasynq::rearm;
|
|
using clock_type = dasynq::clock_type;
|
|
@@ -253,7 +256,7 @@ int main(int argc, char **argv)
|
|
auto shutdown_type = shutdown_type_t::POWEROFF;
|
|
|
|
const char *execname = base_name(argv[0]);
|
|
- if (strcmp(execname, "reboot") == 0) {
|
|
+ if (strcmp(execname, reboot_execname) == 0) {
|
|
shutdown_type = shutdown_type_t::REBOOT;
|
|
}
|
|
|