diff options
author | 2015-11-26 04:48:28 -0500 | |
---|---|---|
committer | 2015-11-26 04:48:28 -0500 | |
commit | 58513b6cba580354031623c11049ab8e0a8e6970 (patch) | |
tree | 10fe96a83fb2a619ef612e105c8dfb4f8ebd26bb /quse.c | |
parent | quse: move file warnings behind verbose (diff) | |
download | portage-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.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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); |