summaryrefslogtreecommitdiff
path: root/src/systemd/src/basic/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/systemd/src/basic/util.c')
-rw-r--r--src/systemd/src/basic/util.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/systemd/src/basic/util.c b/src/systemd/src/basic/util.c
index 687de40993..37fbfbf97f 100644
--- a/src/systemd/src/basic/util.c
+++ b/src/systemd/src/basic/util.c
@@ -177,15 +177,12 @@ int block_get_whole_disk(dev_t d, dev_t *ret) {
}
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;
+ _cleanup_free_ char *s = NULL;
+
+ if (read_one_line_file("/sys/kernel/kexec_loaded", &s) < 0)
+ return false;
+
+ return s[0] == '1';
}
int prot_from_flags(int flags) {