aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-01-15 14:51:37 +0000
committerWerner Koch <[email protected]>2016-01-15 14:52:11 +0000
commita38dffde7b19bd4881afcd87c23aac2daa5bd52a (patch)
treef404f021d15e1f9be728854c9370a46e4d8a0897
parentFix to support git worktree. (diff)
downloadgnupg-a38dffde7b19bd4881afcd87c23aac2daa5bd52a.tar.gz
gnupg-a38dffde7b19bd4881afcd87c23aac2daa5bd52a.zip
Fix possible AIX problem with sysconf in rndunix.
* cipher/rndunix.c [HAVE_STDINT_H]: Include stdint.h. (start_gatherer): Detect misbehaving sysconf. -- See GnuPG-bug-id: 1778 for the reason of this patch. There is no concrete bug report but this chnage should not harm. Signed-off-by: Werner Koch <[email protected]>
-rw-r--r--cipher/rndunix.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/cipher/rndunix.c b/cipher/rndunix.c
index 72905e63b..5cf2b9e1e 100644
--- a/cipher/rndunix.c
+++ b/cipher/rndunix.c
@@ -50,6 +50,9 @@
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
#include <string.h>
#include <assert.h>
@@ -700,12 +703,18 @@ start_gatherer( int pipefd )
{ int nmax, n1, i;
#ifdef _SC_OPEN_MAX
if( (nmax=sysconf( _SC_OPEN_MAX )) < 0 ) {
-#ifdef _POSIX_OPEN_MAX
+# ifdef _POSIX_OPEN_MAX
nmax = _POSIX_OPEN_MAX;
-#else
+# else
nmax = 20; /* assume a reasonable value */
-#endif
+# endif
}
+ /* AIX returns INT32_MAX instead of a proper value. We assume that
+ * this is always an error and use a reasonable value. */
+# ifdef INT32_MAX
+ if (nmax == INT32_MAX)
+ nmax = 20;
+# endif
#else
nmax = 20; /* assume a reasonable value */
#endif