]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sleep-config: check if we operate on regular file in swap_device_to_device_id() in...
authorLennart Poettering <lennart@poettering.net>
Tue, 20 Jun 2023 10:26:46 +0000 (12:26 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 20 Jun 2023 11:13:54 +0000 (13:13 +0200)
Similar to the previous commit: before we continue doing swap file
operations let's ensure this actually is a swap file.

src/shared/sleep-config.c

index cee0a69cb01205449710120f6859a002bf964324..0db02fae87b8ae5133a46b1d72c6e5151bf748ff 100644 (file)
@@ -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);
 }