Browse Source

Merge commit 'eb880ee' into bfgminer

Luke Dashjr 11 years ago
parent
commit
9b51fee3c3
2 changed files with 10 additions and 14 deletions
  1. 3 3
      miner.c
  2. 7 11
      miner.h

+ 3 - 3
miner.c

@@ -11422,7 +11422,7 @@ static void raise_fd_limits(void)
 {
 {
 #ifdef HAVE_SETRLIMIT
 #ifdef HAVE_SETRLIMIT
 	struct rlimit fdlimit;
 	struct rlimit fdlimit;
-	unsigned long old_soft_limit;
+	rlim_t old_soft_limit;
 	char frombuf[0x10] = "unlimited";
 	char frombuf[0x10] = "unlimited";
 	char hardbuf[0x10] = "unlimited";
 	char hardbuf[0x10] = "unlimited";
 	
 	
@@ -11439,11 +11439,11 @@ static void raise_fd_limits(void)
 	if (fdlimit.rlim_max != RLIM_INFINITY)
 	if (fdlimit.rlim_max != RLIM_INFINITY)
 		snprintf(hardbuf, sizeof(hardbuf), "%lu", (unsigned long)fdlimit.rlim_max);
 		snprintf(hardbuf, sizeof(hardbuf), "%lu", (unsigned long)fdlimit.rlim_max);
 	if (old_soft_limit != RLIM_INFINITY)
 	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)
 	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)",
 		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))
 	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)",
 		applogr(, LOG_DEBUG, "setrlimit: Failed to change soft fd limit from %s to %lu (FD_SETSIZE=%lu; hard limit=%s)",

+ 7 - 11
miner.h

@@ -52,19 +52,15 @@
 #endif
 #endif
 #ifdef HAVE_ALLOCA_H
 #ifdef HAVE_ALLOCA_H
 # include <alloca.h>
 # include <alloca.h>
-#elif defined __GNUC__
-# ifndef WIN32
+#elif !defined alloca
+# ifdef __GNUC__
 #  define alloca __builtin_alloca
 #  define alloca __builtin_alloca
-# else
+# elif defined _AIX
+#  define alloca __alloca
+# elif defined _MSC_VER
 #  include <malloc.h>
 #  include <malloc.h>
-# endif
-#elif defined _AIX
-# define alloca __alloca
-#elif defined _MSC_VER
-# include <malloc.h>
-# define alloca _alloca
-#else
-# ifndef HAVE_ALLOCA
+#  define alloca _alloca
+# elif !defined HAVE_ALLOCA
 #  ifdef  __cplusplus
 #  ifdef  __cplusplus
 extern "C"
 extern "C"
 #  endif
 #  endif