Browse Source

Bugfix: Use rlim_t type for old_soft_limit so comparison with RLIM_INFINITY is correct on all platforms

Luke Dashjr 12 years ago
parent
commit
eb880ee0e9
1 changed files with 3 additions and 3 deletions
  1. 3 3
      miner.c

+ 3 - 3
miner.c

@@ -10363,7 +10363,7 @@ static void raise_fd_limits(void)
 {
 #ifdef HAVE_SETRLIMIT
 	struct rlimit fdlimit;
-	unsigned long old_soft_limit;
+	rlim_t old_soft_limit;
 	char frombuf[0x10] = "unlimited";
 	char hardbuf[0x10] = "unlimited";
 	
@@ -10380,11 +10380,11 @@ static void raise_fd_limits(void)
 	if (fdlimit.rlim_max != RLIM_INFINITY)
 		snprintf(hardbuf, sizeof(hardbuf), "%lu", (unsigned long)fdlimit.rlim_max);
 	if (old_soft_limit != RLIM_INFINITY)
-		snprintf(frombuf, sizeof(frombuf), "%lu", old_soft_limit);
+		snprintf(frombuf, sizeof(frombuf), "%lu", (unsigned long)old_soft_limit);
 	
 	if (fdlimit.rlim_cur == old_soft_limit)
 		applogr(, LOG_DEBUG, "setrlimit: Soft fd limit not being changed from %lu (FD_SETSIZE=%lu; hard limit=%s)",
-		        old_soft_limit, (unsigned long)FD_SETSIZE, hardbuf);
+		        (unsigned long)old_soft_limit, (unsigned long)FD_SETSIZE, hardbuf);
 	
 	if (setrlimit(RLIMIT_NOFILE, &fdlimit))
 		applogr(, LOG_DEBUG, "setrlimit: Failed to change soft fd limit from %s to %lu (FD_SETSIZE=%lu; hard limit=%s)",