[asterisk-commits] tilghman: branch 1.6.2 r312287 - in /branches/1.6.2: ./ include/asterisk/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 1 05:51:28 CDT 2011


Author: tilghman
Date: Fri Apr  1 05:51:24 2011
New Revision: 312287

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=312287
Log:
Merged revisions 312285 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r312285 | tilghman | 2011-04-01 05:36:42 -0500 (Fri, 01 Apr 2011) | 7 lines
  
  Found some leaking file descriptors while looking at ast_FD_SETSIZE dead code.
  
  (issue #18969)
   Reported by: oej
   Patches: 
         20110315__issue18969__14.diff.txt uploaded by tilghman (license 14)
........

Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/include/asterisk/select.h
    branches/1.6.2/main/asterisk.c

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: branches/1.6.2/include/asterisk/select.h
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/include/asterisk/select.h?view=diff&rev=312287&r1=312286&r2=312287
==============================================================================
--- branches/1.6.2/include/asterisk/select.h (original)
+++ branches/1.6.2/include/asterisk/select.h Fri Apr  1 05:51:24 2011
@@ -38,8 +38,9 @@
 #if !defined(HAVE_VARIABLE_FDSET) && defined(CONFIGURE_RAN_AS_ROOT)
 #define ast_fdset fd_set
 #else
+#define ast_FDMAX	32768
 typedef struct {
-	TYPEOF_FD_SET_FDS_BITS fds_bits[4096 / SIZEOF_FD_SET_FDS_BITS]; /* 32768 bits */
+	TYPEOF_FD_SET_FDS_BITS fds_bits[ast_FDMAX / 8 / SIZEOF_FD_SET_FDS_BITS]; /* 32768 bits */
 } ast_fdset;
 
 #undef FD_ZERO

Modified: branches/1.6.2/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/main/asterisk.c?view=diff&rev=312287&r1=312286&r2=312287
==============================================================================
--- branches/1.6.2/main/asterisk.c (original)
+++ branches/1.6.2/main/asterisk.c Fri Apr  1 05:51:24 2011
@@ -3365,6 +3365,7 @@
 		fd2 = (l.rlim_cur > sizeof(readers) * 8 ? sizeof(readers) * 8 : l.rlim_cur) - 1;
 		if (dup2(fd, fd2) < 0) {
 			ast_log(LOG_WARNING, "Cannot open maximum file descriptor %d at boot? %s\n", fd2, strerror(errno));
+			close(fd);
 			break;
 		}
 
@@ -3373,9 +3374,12 @@
 		if (ast_select(fd2 + 1, &readers, NULL, NULL, &tv) < 0) {
 			ast_log(LOG_WARNING, "Maximum select()able file descriptor is %d\n", FD_SETSIZE);
 		}
+		ast_FD_SETSIZE = l.rlim_cur > ast_FDMAX ? ast_FDMAX : l.rlim_cur;
+		close(fd);
+		close(fd2);
 	} while (0);
 #elif defined(HAVE_VARIABLE_FDSET)
-	ast_FD_SETSIZE = l.rlim_cur;
+	ast_FD_SETSIZE = l.rlim_cur > ast_FDMAX ? ast_FDMAX : l.rlim_cur;
 #endif /* !defined(CONFIGURE_RAN_AS_ROOT) */
 
 	if ((!rungroup) && !ast_strlen_zero(ast_config_AST_RUN_GROUP))




More information about the asterisk-commits mailing list