diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-06-10 16:40:52 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2020-06-11 10:33:56 +0200 |
commit | 6f9120ad6181fcd7316f5963557cd8d84a5979c8 (patch) | |
tree | e7696bc4b643c58962f57cce0cb626c46817df46 /src/shared/sleep-config.c | |
parent | sleep-config: add more debug logging (diff) | |
download | systemd-6f9120ad6181fcd7316f5963557cd8d84a5979c8.tar.xz systemd-6f9120ad6181fcd7316f5963557cd8d84a5979c8.zip |
sleep-config: return correct error code
Diffstat (limited to 'src/shared/sleep-config.c')
-rw-r--r-- | src/shared/sleep-config.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c index 0e6fd41dce..616bd66c1b 100644 --- a/src/shared/sleep-config.c +++ b/src/shared/sleep-config.c @@ -133,9 +133,9 @@ int can_sleep_state(char **types) { } int can_sleep_disk(char **types) { + _cleanup_free_ char *p = NULL; char **type; int r; - _cleanup_free_ char *p = NULL; if (strv_isempty(types)) return true; @@ -203,16 +203,17 @@ static int swap_device_to_device_id(const SwapEntry *swap, dev_t *ret_dev) { r = stat(swap->device, &sb); if (r < 0) - return r; + return -errno; if (streq(swap->type, "partition")) { if (!S_ISBLK(sb.st_mode)) return -ENOTBLK; + *ret_dev = sb.st_rdev; return 0; + } - } else - return get_block_device(swap->device, ret_dev); + return get_block_device(swap->device, ret_dev); } /* |