From 7e2d62de7b908b95933cdf20316324d9f82dac0d Mon Sep 17 00:00:00 2001 From: Silvan Jegen Date: Sun, 11 Dec 2022 21:34:23 +0100 Subject: text-io: close "cwd" in all cases --- text-io.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/text-io.c b/text-io.c index a8d9cc0..509df35 100644 --- a/text-io.c +++ b/text-io.c @@ -242,9 +242,10 @@ static int mkstempat(int dirfd, char *template) { fd = mkstemp(template); err: if (cwd != -1) { - if (fchdir(cwd) != 0) - return -1; + int ret = fchdir(cwd); close(cwd); + if (ret != 0) + return -1; } return fd; } -- cgit v1.2.3