mirror of
https://github.com/systemd/systemd.git
synced 2024-12-25 01:34:28 +03:00
shared/sleep-config: fix error handling for open
CID#1406472.
This commit is contained in:
parent
21b40f1662
commit
e97c369153
@ -226,11 +226,10 @@ static int calculate_swap_file_offset(const SwapEntry *swap, uint64_t *ret_offse
|
||||
assert(streq(swap->type, "file"));
|
||||
|
||||
fd = open(swap->device, O_RDONLY|O_CLOEXEC|O_NOCTTY);
|
||||
if (!fd)
|
||||
if (fd < 0)
|
||||
return log_error_errno(errno, "Failed to open %s: %m", swap->device);
|
||||
|
||||
r = fstat(fd, &sb);
|
||||
if (r < 0)
|
||||
if (fstat(fd, &sb) < 0)
|
||||
return log_error_errno(errno, "Failed to stat %s: %m", swap->device);
|
||||
|
||||
btrfs = btrfs_is_filesystem(fd);
|
||||
|
Loading…
Reference in New Issue
Block a user