summaryrefslogtreecommitdiff
path: root/e2fsprogs/old_e2fsprogs
diff options
context:
space:
mode:
authorDenys Vlasenko2011-11-28 18:57:04 +0100
committerDenys Vlasenko2011-11-28 18:57:04 +0100
commit901365fcffbc318395d24a05b6951288562da6af (patch)
tree556b3f3583107d663165a88bcad0ad7af269566e /e2fsprogs/old_e2fsprogs
parent1fd7129bc6b3792f2dc5ff08a77f167c7e628093 (diff)
downloadbusybox-901365fcffbc318395d24a05b6951288562da6af.zip
busybox-901365fcffbc318395d24a05b6951288562da6af.tar.gz
old_e2fsprogs/blkid: close the fd after we are done with it
Some people have HUGE /dev/*... Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'e2fsprogs/old_e2fsprogs')
-rw-r--r--e2fsprogs/old_e2fsprogs/blkid/probe.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/e2fsprogs/old_e2fsprogs/blkid/probe.c b/e2fsprogs/old_e2fsprogs/blkid/probe.c
index 77bfc73..651193b 100644
--- a/e2fsprogs/old_e2fsprogs/blkid/probe.c
+++ b/e2fsprogs/old_e2fsprogs/blkid/probe.c
@@ -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;
}