diff --git a/TODO b/TODO index 445a83ae8aa..5b312649a53 100644 --- a/TODO +++ b/TODO @@ -23,6 +23,13 @@ Janitorial Clean-ups: Features: +* clean up sleep.c: + - Use CLOCK_BOOTTIME_ALARM for waking up s2h instead of RTC ioctls + - Parse sleep.conf only once, and parse its whole contents so that we don't + have to parse it again and again in s2h + - Make sure resume= and resume_offset= on the kernel cmdline always take + precedence + * maybe add a seccomp-based high-level filter that blocks creation of suid/sgid files. diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c index 2e22bd0bbe2..de28f00c656 100644 --- a/src/shared/sleep-config.c +++ b/src/shared/sleep-config.c @@ -17,6 +17,7 @@ #include "conf-parser.h" #include "def.h" #include "env-util.h" +#include "errno-util.h" #include "fd-util.h" #include "fileio.h" #include "log.h" @@ -201,8 +202,7 @@ int find_hibernate_location(char **device, char **type, size_t *size, size_t *us if (!f) { log_full(errno == ENOENT ? LOG_DEBUG : LOG_WARNING, "Failed to retrieve open /proc/swaps: %m"); - assert(errno > 0); - return -errno; + return negative_errno(); } (void) fscanf(f, "%*s %*s %*s %*s %*s\n"); diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c index 4a7ffbd9790..71bc8711211 100644 --- a/src/sleep/sleep.c +++ b/src/sleep/sleep.c @@ -166,7 +166,7 @@ static int execute(char **modes, char **states) { return log_error_errno(r, "Failed to write mode to /sys/power/disk: %m");; } - execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, arguments, NULL, EXEC_DIR_PARALLEL | EXEC_DIR_IGNORE_ERRORS); + (void) execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, arguments, NULL, EXEC_DIR_PARALLEL | EXEC_DIR_IGNORE_ERRORS); log_struct(LOG_INFO, "MESSAGE_ID=" SD_MESSAGE_SLEEP_START_STR, @@ -186,7 +186,7 @@ static int execute(char **modes, char **states) { "SLEEP=%s", arg_verb); arguments[1] = (char*) "post"; - execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, arguments, NULL, EXEC_DIR_PARALLEL | EXEC_DIR_IGNORE_ERRORS); + (void) execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, arguments, NULL, EXEC_DIR_PARALLEL | EXEC_DIR_IGNORE_ERRORS); return r; }