]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sleep: Move the error level debugging for write_mode and write_state 8406/head
authorMario Limonciello <mario.limonciello@dell.com>
Thu, 29 Mar 2018 13:56:23 +0000 (08:56 -0500)
committerMario Limonciello <mario.limonciello@dell.com>
Mon, 9 Apr 2018 18:17:56 +0000 (13:17 -0500)
This makes it more consistent with other code used in the file.

Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
src/sleep/sleep.c

index 1163a0f56ac57481f6099b57a108dd7444164495..cee3f345939d3f64e1a3f3eba40fc7e7f6ffa5f0 100644 (file)
@@ -120,9 +120,6 @@ static int write_mode(char **modes) {
                         r = k;
         }
 
-        if (r < 0)
-                log_error_errno(r, "Failed to write mode to /sys/power/disk: %m");
-
         return r;
 }
 
@@ -144,7 +141,7 @@ static int write_state(FILE **f, char **states) {
                 fclose(*f);
                 *f = fopen("/sys/power/state", "we");
                 if (!*f)
-                        return log_error_errno(errno, "Failed to open /sys/power/state: %m");
+                        return -errno;
         }
 
         return r;
@@ -179,7 +176,7 @@ static int execute(char **modes, char **states) {
                         return log_error_errno(r, "Failed to write hibernation disk offset: %m");
                 r = write_mode(modes);
                 if (r < 0)
-                        return r;
+                        return log_error_errno(r, "Failed to write mode to /sys/power/disk: %m");;
         }
 
         execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, arguments);
@@ -192,7 +189,7 @@ static int execute(char **modes, char **states) {
 
         r = write_state(&f, states);
         if (r < 0)
-                return r;
+                return log_error_errno(r, "Failed to write /sys/power/state: %m");
 
         log_struct(LOG_INFO,
                    "MESSAGE_ID=" SD_MESSAGE_SLEEP_STOP_STR,