summaryrefslogtreecommitdiffstats
path: root/src/shared/sleep-config.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-06-10 16:40:52 +0200
committerLennart Poettering <lennart@poettering.net>2020-06-11 10:33:56 +0200
commit6f9120ad6181fcd7316f5963557cd8d84a5979c8 (patch)
treee7696bc4b643c58962f57cce0cb626c46817df46 /src/shared/sleep-config.c
parentsleep-config: add more debug logging (diff)
downloadsystemd-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.c9
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);
}
/*