sleep-config: return correct error code
This commit is contained in:
parent
c0d8fbfa34
commit
6f9120ad61
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue