projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
545a30a
)
util-lib: simplify kexec_loaded()
author
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Sun, 15 Oct 2017 21:00:54 +0000
(23:00 +0200)
committer
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Wed, 18 Oct 2017 15:14:05 +0000
(17:14 +0200)
src/basic/util.c
patch
|
blob
|
history
diff --git
a/src/basic/util.c
b/src/basic/util.c
index
687de40
..
37fbfbf
100644
(file)
--- a/
src/basic/util.c
+++ b/
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) {