From 6c81764641c7fe4c6ac190a12b9308f4de54cb4e Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Sun, 28 Feb 2021 22:44:47 +0100 Subject: fq: fix fd leak Thanks to @duncaen for reporting. --- fq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fq.c b/fq.c index 1a702d6..ebfe6f8 100644 --- a/fq.c +++ b/fq.c @@ -162,8 +162,10 @@ main(int argc, char *argv[]) /* skip not running jobs, unless -a was passed, or we did not * output anything yet and are at the last argument. */ - if (!aflag && !islocked(fd) && (didsth || i != argc - 1)) + if (!aflag && !islocked(fd) && (didsth || i != argc - 1)) { + close(fd); continue; + } write(1, "==> ", 4); write(1, argv[i], strlen(argv[i])); -- cgit 1.4.1