aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-01-15 15:16:38 +0000
committerWerner Koch <[email protected]>2016-01-15 15:16:38 +0000
commite79199468ac54ce4fe919603ff7bada97267174f (patch)
tree722369488a437a6d320236d3bdd3f58267b248eb
parentw32: Avoid conflict with Mingw-w64 version 4.0.4-1 (diff)
downloadgpgme-e79199468ac54ce4fe919603ff7bada97267174f.tar.gz
gpgme-e79199468ac54ce4fe919603ff7bada97267174f.zip
Fix possible _SC_OPEN_MAX max problem on AIX.
* src/posix-io.c [HAVE_STDINT_H]: Include stdint.h. (get_max_fds): Limit returned value for too high values. -- Signed-off-by: Werner Koch <[email protected]>
-rw-r--r--src/posix-io.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/posix-io.c b/src/posix-io.c
index ac823fc8..e49c71ec 100644
--- a/src/posix-io.c
+++ b/src/posix-io.c
@@ -23,6 +23,9 @@
#endif
#include <stdio.h>
#include <stdlib.h>
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
#include <string.h>
#include <assert.h>
#include <errno.h>
@@ -331,6 +334,16 @@ get_max_fds (void)
fds = 1024;
}
+ /* AIX returns INT32_MAX instead of a proper value. We assume that
+ * this is always an error and use a more reasonable limit. */
+#ifdef INT32_MAX
+ if (fds == INT32_MAX)
+ {
+ source = "aix-fix";
+ fds = 1024;
+ }
+#endif
+
TRACE2 (DEBUG_SYSIO, "gpgme:max_fds", 0, "max fds=%i (%s)", fds, source);
return fds;
}