blob: b74aa046724ddaf4f8efad70b49cd90a5161b89f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
From 01f488c11ec1666c90a81ae2f968f04a9419b186 Mon Sep 17 00:00:00 2001
From: vcrhonek <vcrhonek@fedoraproject.org>
Date: Thu, 24 Jul 2014 15:38:21 +0200
Subject: [PATCH 1/8] 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 32fc47d..a51dc76 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
|