aboutsummaryrefslogtreecommitdiff
path: root/text-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'text-io.c')
-rw-r--r--text-io.c3
1 files changed, 2 insertions, 1 deletions
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;