Merge branch 'broken-windows'

This commit is contained in:
Ward Fisher 2016-04-11 16:25:18 -06:00
commit e32486291a
4 changed files with 7 additions and 1 deletions

View File

@ -1177,6 +1177,7 @@ CHECK_FUNCTION_EXISTS(strtoull HAVE_STROULL)
CHECK_FUNCTION_EXISTS(strstr HAVE_STRSTR)
CHECK_FUNCTION_EXISTS(mkstemp HAVE_MKSTEMP)
CHECK_FUNCTION_EXISTS(rand HAVE_RAND)
CHECK_FUNCTION_EXISTS(random HAVE_RANDOM)
CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
CHECK_FUNCTION_EXISTS(fsync HAVE_FSYNC)
CHECK_FUNCTION_EXISTS(MPI_Comm_f2C HAVE_MPI_COMM_F2C)

View File

@ -272,6 +272,7 @@ are set when opening a binary file on Windows. */
#cmakedefine HAVE_STRSTR
#cmakedefine HAVE_MKSTEMP
#cmakedefine HAVE_RAND
#cmakedefine HAVE_RANDOM
#cmakedefine HAVE_GETTIMEOFDAY
#cmakedefine HAVE_MPI_COMM_F2C
#cmakedefine HAVE_MEMMOVE

View File

@ -750,7 +750,7 @@ AC_HEADER_STDBOOL
# Check for these functions...
AC_CHECK_FUNCS([strlcat strerror snprintf strchr strrchr strcat strcpy \
strdup strcasecmp strtod strtoll strtoull strstr \
mkstemp rand memcmp \
mkstemp rand random memcmp \
getrlimit gettimeofday fsync MPI_Comm_f2c])
# Does the user want to use NC_DISKLESS?

View File

@ -35,7 +35,11 @@ static int isPrime(unsigned long val)
for (i = 9; i--;)
{
#ifdef HAVE_RANDOM
unsigned long a = ((unsigned long)random() % (val-4)) + 2;
#else
unsigned long a = ((unsigned long)rand() % (val - 4)) + 2;
#endif
unsigned long p = 1;
unsigned long exp = val-1;
while (exp)