← Commit list

901365fcf

Denys Vlasenko
Denys Vlasenko
2011-11-28
FAILED Duration: 201s

Subject

old_e2fsprogs/blkid: close the fd after we are done with it

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

e2fsprogs/old_e2fsprogs/blkid/probe.c+7 -2
@@ -575,8 +575,12 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev)
printf("need to revalidate %s (time since last check %lu)\n",
dev->bid_name, diff));
- if (((fd = open(dev->bid_name, O_RDONLY)) < 0) ||
- (fstat(fd, &st) < 0)) {
+ fd = open(dev->bid_name, O_RDONLY);
+ if (fd < 0
+ || fstat(fd, &st) < 0
+ ) {
+ if (fd >= 0)
+ close(fd);
if (errno == ENXIO || errno == ENODEV || errno == ENOENT) {
blkid_free_dev(dev);
return NULL;
@@ -653,6 +657,7 @@ try_again:
if (!dev->bid_type) {
blkid_free_dev(dev);
+ close(fd);
return NULL;
}