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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user