summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorFrederic Crozat <fcrozat@suse.com>2011-08-22 14:58:50 +0200
committerLennart Poettering <lennart@poettering.net>2011-08-24 02:19:30 +0200
commit65457142f12ecc4bb39fad51b73b9d3e6eac4af5 (patch)
tree295b56a9697bf28c50124702e66b4ea1a9cc4311 /src/util.c
parent240fc26e03e93641523315222fea4cfbf71c0ef9 (diff)
initctl: check for kexec_loaded when reboot is requested through initctl
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index 65d4b143dc..6033aa05b2 100644
--- a/src/util.c
+++ b/src/util.c
@@ -5852,3 +5852,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;
+}