summaryrefslogtreecommitdiff
path: root/src/sleep
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-06-10 16:47:38 +0200
committerLennart Poettering <lennart@poettering.net>2020-06-11 10:33:56 +0200
commitc02540dc9e1f28c8598ff1ead0d0f0ed93774313 (patch)
tree435d275a8a2bde85e4e61b68d1606ca58faffe94 /src/sleep
parent6f9120ad6181fcd7316f5963557cd8d84a5979c8 (diff)
downloadsystemd-c02540dc9e1f28c8598ff1ead0d0f0ed93774313.tar.gz
sleep: clean up debug/error logging
half of find_hibernation_location() logged at debug level, the other half logged at error level, and the third half didn't log at all. Let's clean this up somewhat. Since can_sleep() is probably more a library-style function let's downgrade everything to LOG_DEBUG and then make sure sleep.c logs at error level, as the main program.
Diffstat (limited to 'src/sleep')
-rw-r--r--src/sleep/sleep.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
index 11c51fb32b..82e31fe704 100644
--- a/src/sleep/sleep.c
+++ b/src/sleep/sleep.c
@@ -194,12 +194,14 @@ static int execute(char **modes, char **states) {
setvbuf(f, NULL, _IONBF, 0);
- /* Configure the hibernation mode */
+ /* Configure hibernation settings if we are supposed to hibernate */
if (!strv_isempty(modes)) {
r = find_hibernate_location(&hibernate_location);
if (r < 0)
- return r;
- else if (r == 0) {
+ return log_error_errno(r, "Failed to find location to hibernate to: %m");
+ if (r == 0) { /* 0 means: no hibernation location was configured in the kernel so far, let's
+ * do it ourselves then. > 0 means: kernel already had a configured hibernation
+ * location which we shouldn't touch. */
r = write_hibernate_location_info(hibernate_location);
if (r < 0)
return log_error_errno(r, "Failed to prepare for hibernation: %m");