forked from pool/systemd
Frederic Crozat
4e462d819d
- Handle disable_capslock, compose table and kbd_rate - Add rpm macros.systemd file. - Do not disable klogd, it has its own service now. - Handle kexec correctly (bnc#671673). - Disable preload services, they are conflicting with systemd. >>>>>>> .new OBS-URL: https://build.opensuse.org/request/show/79603 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=181
83 lines
2.3 KiB
Diff
83 lines
2.3 KiB
Diff
From b1e304bb59e1a80abacfd6f0377ae14c3c1a10cc Mon Sep 17 00:00:00 2001
|
|
From: Frederic Crozat <fcrozat@suse.com>
|
|
Date: Mon, 22 Aug 2011 14:58:50 +0200
|
|
Subject: [PATCH] initctl: check for kexec_loaded when reboot is requested through initctl
|
|
|
|
---
|
|
src/initctl.c | 2 ++
|
|
src/systemctl.c | 12 ------------
|
|
src/util.c | 12 ++++++++++++
|
|
src/util.h | 2 ++
|
|
4 files changed, 16 insertions(+), 12 deletions(-)
|
|
|
|
diff --git a/src/initctl.c b/src/initctl.c
|
|
index f36f1cc..eaa717a 100644
|
|
--- a/src/initctl.c
|
|
+++ b/src/initctl.c
|
|
@@ -93,6 +93,8 @@ static const char *translate_runlevel(int runlevel, bool *isolate) {
|
|
for (i = 0; i < ELEMENTSOF(table); i++)
|
|
if (table[i].runlevel == runlevel) {
|
|
*isolate = table[i].isolate;
|
|
+ if (runlevel == '6' && kexec_loaded())
|
|
+ return SPECIAL_KEXEC_TARGET;
|
|
return table[i].special;
|
|
}
|
|
|
|
diff --git a/src/systemctl.c b/src/systemctl.c
|
|
index bb998d3..0ff9221 100644
|
|
--- a/src/systemctl.c
|
|
+++ b/src/systemctl.c
|
|
@@ -4403,18 +4403,6 @@ static int parse_time_spec(const char *t, usec_t *_u) {
|
|
return 0;
|
|
}
|
|
|
|
-static bool kexec_loaded(void) {
|
|
- bool loaded = false;
|
|
- char *s;
|
|
-
|
|
- if (read_one_line_file("/sys/kernel/kexec_loaded", &s) >= 0) {
|
|
- if (s[0] == '1')
|
|
- loaded = true;
|
|
- free(s);
|
|
- }
|
|
- return loaded;
|
|
-}
|
|
-
|
|
static int shutdown_parse_argv(int argc, char *argv[]) {
|
|
|
|
enum {
|
|
diff --git a/src/util.c b/src/util.c
|
|
index 8d54049..247156d 100644
|
|
--- a/src/util.c
|
|
+++ b/src/util.c
|
|
@@ -5680,3 +5680,15 @@ static const char *const signal_table[] = {
|
|
};
|
|
|
|
DEFINE_STRING_TABLE_LOOKUP(signal, int);
|
|
+
|
|
+bool kexec_loaded(void) {
|
|
+ bool loaded = false;
|
|
+ char *s;
|
|
+
|
|
+ if (read_one_line_file("/sys/kernel/kexec_loaded", &s) >= 0) {
|
|
+ if (s[0] == '1')
|
|
+ loaded = true;
|
|
+ free(s);
|
|
+ }
|
|
+ return loaded;
|
|
+}
|
|
diff --git a/src/util.h b/src/util.h
|
|
index 407160d..8b31e5b 100644
|
|
--- a/src/util.h
|
|
+++ b/src/util.h
|
|
@@ -497,4 +497,6 @@ int signal_from_string_try_harder(const char *s);
|
|
extern int saved_argc;
|
|
extern char **saved_argv;
|
|
|
|
+bool kexec_loaded(void);
|
|
+
|
|
#endif
|
|
--
|
|
1.7.3.4
|
|
|