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 <wk@gnupg.org>
This commit is contained in:
Werner Koch 2016-01-15 16:16:38 +01:00
parent 83415dffae
commit e79199468a
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -23,6 +23,9 @@
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
@ -331,6 +334,16 @@ get_max_fds (void)
fds = 1024; 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); TRACE2 (DEBUG_SYSIO, "gpgme:max_fds", 0, "max fds=%i (%s)", fds, source);
return fds; return fds;
} }