tcsh/tcsh-6.15.00-closem.patch
Pavel Raiskup 97c6af701c spec: move to %autosetup
Version: 6.18.01-12
2014-08-27 16:32:53 +02:00

43 lines
1.1 KiB
Diff

From fbf64f9d9addb60153732298ec7e9bf592831bf2 Mon Sep 17 00:00:00 2001
From: Miloslav Trmac <mitr@fedoraproject.org>
Date: Wed, 27 Aug 2014 13:29:02 +0200
Subject: [PATCH 01/14] Do not close sockets
orig dist-git commit: f02674e96a7888a7322611b45f6b63a1f5db0fef
---
sh.misc.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/sh.misc.c b/sh.misc.c
index 08ec30d..08d110f 100644
--- a/sh.misc.c
+++ b/sh.misc.c
@@ -257,6 +257,7 @@ void
closem(void)
{
int f, num_files;
+ struct stat st;
#ifdef NLS_BUGS
#ifdef NLS_CATALOGS
@@ -274,6 +275,16 @@ closem(void)
#ifdef MALLOC_TRACE
&& f != 25
#endif /* MALLOC_TRACE */
+#ifdef S_ISSOCK
+ /* NSS modules (e.g. Linux nss_ldap) might keep sockets open.
+ * If we close such a socket, both the NSS module and tcsh think
+ * they "own" the descriptor.
+ *
+ * Not closing sockets does not make the cleanup use of closem()
+ * less reliable because tcsh never creates sockets.
+ */
+ && fstat(f, &st) == 0 && !S_ISSOCK(st.st_mode)
+#endif
)
{
xclose(f);
--
1.9.3