summaryrefslogtreecommitdiff
path: root/src/shared/sleep-config.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-09-07 19:01:41 +0200
committerLennart Poettering <lennart@poettering.net>2020-09-08 18:10:26 +0200
commitd161680e7afb7ae01593ffc5deb6c02bbc08ed19 (patch)
tree44085f1277d8de936648d3099a875b907c86182d /src/shared/sleep-config.c
parent67f0ac8c79bb08451a70ee314daf06ee081ef24d (diff)
downloadsystemd-d161680e7afb7ae01593ffc5deb6c02bbc08ed19.tar.gz
tree-wide: if get_block_device() returns zero devno, check for it in all cases
And add a comment for the existing cases where things aren't clear already.
Diffstat (limited to 'src/shared/sleep-config.c')
-rw-r--r--src/shared/sleep-config.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index 0dccc8f970..96c125b993 100644
--- a/src/shared/sleep-config.c
+++ b/src/shared/sleep-config.c
@@ -403,6 +403,8 @@ int find_hibernate_location(HibernateLocation **ret_hibernate_location) {
r = swap_device_to_device_id(swap, &swap_device);
if (r < 0)
return log_debug_errno(r, "%s: failed to query device number: %m", swap->device);
+ if (swap_device == 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENODEV), "%s: not backed by block device.", swap->device);
hibernate_location = hibernate_location_free(hibernate_location);
hibernate_location = new(HibernateLocation, 1);