# HG changeset patch # User Bram Moolenaar # Date 1634721304 -7200 # Node ID 31c1c203967897d527a262f3a7e61a18de9ae9f9 # Parent 137f3bc0383193e5720b936c28042f8dffbce01a patch 8.2.3544: Unix: may leak file descriptor using non-existing directory Commit: https://github.com/vim/vim/commit/051a40c8d91d4595c69a27375f739367d806a475 Author: itchyny Date: Wed Oct 20 10:00:05 2021 +0100 patch 8.2.3544: Unix: may leak file descriptor using non-existing directory Problem: Unix: may leak file descriptor when using a non-existing directory. Solution: Always close the file. (closes #9023) diff --git a/src/os_unix.c b/src/os_unix.c --- 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) diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -758,6 +758,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3544, +/**/ 3543, /**/ 3542,