diff options
author | itchyny <itchyny@hatena.ne.jp> | 2021-10-20 10:00:05 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-10-20 10:00:05 +0100 |
commit | 051a40c8d91d4595c69a27375f739367d806a475 (patch) | |
tree | 827ba05c4da3dd6397d7c004e0981b7b34f73151 /src/os_unix.c | |
parent | 8b0e62c93b6dad5ec5b2c7558d4f7b78c46216d2 (diff) | |
download | vim-git-051a40c8d91d4595c69a27375f739367d806a475.tar.gz |
patch 8.2.3544: Unix: may leak file descriptor using non-existing directoryv8.2.3544
Problem: Unix: may leak file descriptor when using a non-existing
directory.
Solution: Always close the file. (closes #9023)
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index 9dde754f3..0b2b5725e 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -2681,7 +2681,6 @@ mch_FullName( verbose_leave(); } l = fchdir(fd); - close(fd); } else #endif @@ -2689,6 +2688,10 @@ mch_FullName( if (l != 0) emsg(_(e_prev_dir)); } +#ifdef HAVE_FCHDIR + if (fd >= 0) + close(fd); +#endif l = STRLEN(buf); if (l >= len - 1) |