diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 19:57:32 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 19:57:32 +0100 |
commit | 4a62c710b62a5a3c7a8a278b810b9d5b5a0c8f4f (patch) | |
tree | c7a6228e7151aa74bc8e331694a1e795226550cd /src/sleep/sleep.c | |
parent | treewide: use log_*_errno whenever %m is in the format string (diff) | |
download | systemd-4a62c710b62a5a3c7a8a278b810b9d5b5a0c8f4f.tar.xz systemd-4a62c710b62a5a3c7a8a278b810b9d5b5a0c8f4f.zip |
treewide: another round of simplifications
Using the same scripts as in f647962d64e "treewide: yet more log_*_errno
+ return simplifications".
Diffstat (limited to 'src/sleep/sleep.c')
-rw-r--r-- | src/sleep/sleep.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c index a7506ed771..415893ba74 100644 --- a/src/sleep/sleep.c +++ b/src/sleep/sleep.c @@ -77,10 +77,8 @@ static int write_state(FILE **f, char **states) { fclose(*f); *f = fopen("/sys/power/state", "we"); - if (!*f) { - log_error_errno(errno, "Failed to open /sys/power/state: %m"); - return -errno; - } + if (!*f) + return log_error_errno(errno, "Failed to open /sys/power/state: %m"); } return r; @@ -101,10 +99,8 @@ static int execute(char **modes, char **states) { /* This file is opened first, so that if we hit an error, * we can abort before modifying any state. */ f = fopen("/sys/power/state", "we"); - if (!f) { - log_error_errno(errno, "Failed to open /sys/power/state: %m"); - return -errno; - } + if (!f) + return log_error_errno(errno, "Failed to open /sys/power/state: %m"); /* Configure the hibernation mode */ r = write_mode(modes); |