mirror of
https://github.com/tmux/tmux.git
synced 2025-01-14 20:58:53 +00:00
Don't leak dotfd if fchdir fails. From ettl dot martin78 at gmail dot com.
This commit is contained in:
parent
02a848d77c
commit
dca084e703
@ -40,8 +40,12 @@ openat(int fd, const char *path, int flags, ...)
|
|||||||
dotfd = open(".", O_RDONLY);
|
dotfd = open(".", O_RDONLY);
|
||||||
if (dotfd == -1)
|
if (dotfd == -1)
|
||||||
return (-1);
|
return (-1);
|
||||||
if (fchdir(fd) != 0)
|
if (fchdir(fd) != 0) {
|
||||||
|
saved_errno = errno;
|
||||||
|
close(dotfd);
|
||||||
|
errno = saved_errno;
|
||||||
return (-1);
|
return (-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = open(path, flags, mode);
|
retval = open(path, flags, mode);
|
||||||
|
Loading…
Reference in New Issue
Block a user