summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-10-24 12:38:04 +0200
committerLennart Poettering <lennart@poettering.net>2018-10-24 12:38:04 +0200
commit58220e6b913400fb2453bb43c4f188cdc40aaecf (patch)
tree466117d7f2d051f03514f99fae914e3688518da7 /src
parentf00aff0a0278fbbe883dac9b907fdf5092ff52bc (diff)
downloadsystemd-58220e6b913400fb2453bb43c4f188cdc40aaecf.tar.gz
systemd-58220e6b913400fb2453bb43c4f188cdc40aaecf.tar.bz2
systemd-58220e6b913400fb2453bb43c4f188cdc40aaecf.zip
sleep: don't make up errors, propagate the right ones
Diffstat (limited to 'src')
-rw-r--r--src/sleep/sleep.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
index 4b49d6aaef..cab3442185 100644
--- a/src/sleep/sleep.c
+++ b/src/sleep/sleep.c
@@ -190,10 +190,13 @@ static int execute(char **modes, char **states) {
static int read_wakealarm(uint64_t *result) {
_cleanup_free_ char *t = NULL;
+ int r;
+
+ r = read_one_line_file("/sys/class/rtc/rtc0/since_epoch", &t);
+ if (r < 0)
+ return r;
- if (read_one_line_file("/sys/class/rtc/rtc0/since_epoch", &t) >= 0)
- return safe_atou64(t, result);
- return -EBADF;
+ return safe_atou64(t, result);
}
static int write_wakealarm(const char *str) {