Sophie

Sophie

distrib > Mageia > 3 > i586 > media > core-release-src > by-pkgid > f8187f2f0ae8e69c55c5ecfbab772e0a > files > 4

tcsh-6.18.01-2.mga3.src.rpm

Index: sh.misc.c
===================================================================
--- sh.misc.c
+++ sh.misc.c	2012-01-22 22:54:23.645356855 +0100
@@ -257,6 +257,7 @@
 closem(void)
 {
     int f, num_files;
+    struct stat st;
 
 #ifdef NLS_BUGS
 #ifdef NLS_CATALOGS
@@ -274,6 +275,16 @@
 #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);