aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO1
-rw-r--r--compat/openat.c6
2 files changed, 5 insertions, 2 deletions
diff --git a/TODO b/TODO
index ce7b1f15..6f8d732c 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,4 @@
- command bits and pieces:
- * why doesn't command-prompt work if made read-only?
* allow multiple targets: fnmatch for -t/-c, for example detach all
clients with -t*
* add -c for new-session like new-window
diff --git a/compat/openat.c b/compat/openat.c
index 5cd9e551..6b04eedc 100644
--- a/compat/openat.c
+++ b/compat/openat.c
@@ -40,8 +40,12 @@ openat(int fd, const char *path, int flags, ...)
dotfd = open(".", O_RDONLY);
if (dotfd == -1)
return (-1);
- if (fchdir(fd) != 0)
+ if (fchdir(fd) != 0) {
+ saved_errno = errno;
+ close(dotfd);
+ errno = saved_errno;
return (-1);
+ }
}
retval = open(path, flags, mode);