shared/sleep-config: fix error handling for open
CID#1406472.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user