vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit f1a721a42d19d8aba556b8f97ce027c798dbe51c parent 91e0e4efc03a9fdfe914a3fb1e34ebd3dcdda2a5 Author: Silvan Jegen <s.jegen@gmail.com> Date: Sun, 11 Dec 2022 21:34:23 +0100 text-io: close "cwd" in all cases Diffstat:
| M | text-io.c | | | 5 | +++-- |
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git 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; }