hibernate-util: read_fiemap: add missing asserts

This commit is contained in:
Mike Yuan
2023-09-30 23:32:08 +08:00
parent a0f6d74ec8
commit 2abc3c6d48

View File

@@ -390,6 +390,9 @@ int read_fiemap(int fd, struct fiemap **ret) {
uint64_t fiemap_start = 0, fiemap_length;
const size_t n_extra = DIV_ROUND_UP(sizeof(struct fiemap), sizeof(struct fiemap_extent));
assert(fd >= 0);
assert(ret);
if (fstat(fd, &statinfo) < 0)
return log_debug_errno(errno, "Cannot determine file size: %m");
if (!S_ISREG(statinfo.st_mode))