From: Lennart Poettering Date: Tue, 20 Jun 2023 10:26:46 +0000 (+0200) Subject: sleep-config: check if we operate on regular file in swap_device_to_device_id() in... X-Git-Tag: v254-rc1~164^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=08e0ed300ad369e0389dfd9335ef6d91b4f8501a;p=thirdparty%2Fsystemd.git sleep-config: check if we operate on regular file in swap_device_to_device_id() in swap file code path Similar to the previous commit: before we continue doing swap file operations let's ensure this actually is a swap file. --- diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c index cee0a69cb01..0db02fae87b 100644 --- a/src/shared/sleep-config.c +++ b/src/shared/sleep-config.c @@ -631,6 +631,10 @@ static int swap_device_to_device_id(const SwapEntry *swap, dev_t *ret_dev) { return 0; } + r = stat_verify_regular(&sb); + if (r < 0) + return r; + return get_block_device(swap->device, ret_dev); }