From 8907c0c6c354ee2548cbb2f01ff3df6dff9fc29a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= Date: Fri, 9 Dec 2022 15:22:03 +0100 Subject: Add dealing with error value from fchdir in text-io.c --- text-io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'text-io.c') diff --git a/text-io.c b/text-io.c index c6d7fa6..a8d9cc0 100644 --- a/text-io.c +++ b/text-io.c @@ -242,7 +242,8 @@ static int mkstempat(int dirfd, char *template) { fd = mkstemp(template); err: if (cwd != -1) { - fchdir(cwd); + if (fchdir(cwd) != 0) + return -1; close(cwd); } return fd; -- cgit v1.2.3