aboutsummaryrefslogtreecommitdiff
path: root/quse.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-11-26 04:48:28 -0500
committerMike Frysinger <vapier@gentoo.org>2015-11-26 04:48:28 -0500
commit58513b6cba580354031623c11049ab8e0a8e6970 (patch)
tree10fe96a83fb2a619ef612e105c8dfb4f8ebd26bb /quse.c
parentquse: move file warnings behind verbose (diff)
downloadportage-utils-58513b6cba580354031623c11049ab8e0a8e6970.tar.gz
portage-utils-58513b6cba580354031623c11049ab8e0a8e6970.tar.bz2
portage-utils-58513b6cba580354031623c11049ab8e0a8e6970.zip
quse: fix invalid close
This happens to work normally as we only have fds {0,1,2} open and {3} is the active file we're working on. Since the f loop contains 3 (for an unrelated reason), we close the right fd. But if there are more/fewer fd's open at start, it might fail, and we leak the FILE* structure. Switch to closing the right file pointer to avoid all this mess.
Diffstat (limited to 'quse.c')
-rw-r--r--quse.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/quse.c b/quse.c
index c7c1863d..5ef88da4 100644
--- a/quse.c
+++ b/quse.c
@@ -205,7 +205,7 @@ quse_describe_flag(unsigned int ind, unsigned int argc, char **argv)
if (!strcmp(argv[i], buf))
printf(" %s%s%s:%s%s%s: %s\n", BOLD, de->d_name, NORM, BLUE, argv[i], NORM, p);
}
- close(f);
+ fclose(fp[0]);
}
closedir(d);