]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sleep: don't make up errors, propagate the right ones
authorLennart Poettering <lennart@poettering.net>
Wed, 24 Oct 2018 10:38:04 +0000 (12:38 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 24 Oct 2018 10:38:04 +0000 (12:38 +0200)
src/sleep/sleep.c

index 4b49d6aaef40384339e9fa6c269b5f6fada8e68d..cab3442185b3409e336e60286c50c74f2278ddde 100644 (file)
@@ -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) {