From 051a40c8d91d4595c69a27375f739367d806a475 Mon Sep 17 00:00:00 2001 From: itchyny Date: Wed, 20 Oct 2021 10:00:05 +0100 Subject: 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) --- src/os_unix.c | 5 ++++- src/version.c | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) 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) diff --git a/src/version.c b/src/version.c index c3f1fd6ab..227db829a 100644 --- a/src/version.c +++ b/src/version.c @@ -757,6 +757,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3544, /**/ 3543, /**/ -- cgit v1.2.1