diff options
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 12 |
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; +} |