Fixed a possible FD leak, CID 702009.
This commit is contained in:
@@ -230,6 +230,8 @@ BFSPartitionHandle::Repair(bool checkOnly)
|
|||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return errno;
|
return errno;
|
||||||
|
|
||||||
|
FileDescriptorCloser closer(fd);
|
||||||
|
|
||||||
struct check_control result;
|
struct check_control result;
|
||||||
memset(&result, 0, sizeof(result));
|
memset(&result, 0, sizeof(result));
|
||||||
result.magic = BFS_IOCTL_CHECK_MAGIC;
|
result.magic = BFS_IOCTL_CHECK_MAGIC;
|
||||||
@@ -295,12 +297,8 @@ BFSPartitionHandle::Repair(bool checkOnly)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// stop checking
|
// stop checking
|
||||||
if (ioctl(fd, BFS_IOCTL_STOP_CHECKING, &result, sizeof(result)) != 0) {
|
if (ioctl(fd, BFS_IOCTL_STOP_CHECKING, &result, sizeof(result)) != 0)
|
||||||
close(fd);
|
|
||||||
return errno;
|
return errno;
|
||||||
}
|
|
||||||
|
|
||||||
close(fd);
|
|
||||||
|
|
||||||
printf(" %" B_PRIu64 " nodes checked,\n\t%" B_PRIu64 " blocks not "
|
printf(" %" B_PRIu64 " nodes checked,\n\t%" B_PRIu64 " blocks not "
|
||||||
"allocated,\n\t%" B_PRIu64 " blocks already set,\n\t%" B_PRIu64
|
"allocated,\n\t%" B_PRIu64 " blocks already set,\n\t%" B_PRIu64
|
||||||
|
|||||||
Reference in New Issue
Block a user