[105765] trunk/base/src/pextlib1.0/tracelib.c

cal at macports.org cal at macports.org
Sun May 5 12:44:56 PDT 2013


Revision: 105765
          https://trac.macports.org/changeset/105765
Author:   cal at macports.org
Date:     2013-05-05 12:44:56 -0700 (Sun, 05 May 2013)
Log Message:
-----------
tracelib.c: Fix setrlimit with uninitialized fields

Modified Paths:
--------------
    trunk/base/src/pextlib1.0/tracelib.c

Modified: trunk/base/src/pextlib1.0/tracelib.c
===================================================================
--- trunk/base/src/pextlib1.0/tracelib.c	2013-05-05 14:32:25 UTC (rev 105764)
+++ trunk/base/src/pextlib1.0/tracelib.c	2013-05-05 19:44:56 UTC (rev 105765)
@@ -429,17 +429,20 @@
 	pthread_mutex_unlock(&sock_mutex);
 	
 	interp=in;
-	
+
 	/* raise the limit of open files to the maximum from the default soft limit
 	 * of 256 */
+	if (getrlimit(RLIMIT_NOFILE, &rl) == -1) {
+		ui_warn("getrlimit failed (%d), skipping setrlimit", errno);
+	} else {
 #if defined(__APPLE__) && defined(OPEN_MAX)
-	if (rl.rlim_max > OPEN_MAX)
-		rl.rlim_max = OPEN_MAX;
+		if (rl.rlim_max > OPEN_MAX)
+			rl.rlim_max = OPEN_MAX;
 #endif
-	rl.rlim_cur = rl.rlim_max;
-	if(setrlimit(RLIMIT_NOFILE, &rl)==-1)
-	{
-		ui_warn("setrlimit failed (%d)", errno);
+		rl.rlim_cur = rl.rlim_max;
+		if (setrlimit(RLIMIT_NOFILE, &rl) == -1) {
+			ui_warn("setrlimit failed (%d)", errno);
+		}
 	}
 
 	
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130505/419b565e/attachment.html>


More information about the macports-changes mailing list