Verify that sysconf does not return -1. It is not important if it's due
to an error or due to a missing upper boundary. In both cases, fall back
to a constant value.
Reviewed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
/* invalid shadow time indicating missing entry */
#define MISSING_TIME -2
+#ifndef NGROUPS_MAX
+#define NGROUPS_MAX 65536
+#endif
+
/*
* Structures
*/
#endif
sys_ngroups = sysconf (_SC_NGROUPS_MAX);
+ if (sys_ngroups == -1)
+ sys_ngroups = NGROUPS_MAX;
user_groups = xmalloc_T(sys_ngroups + 1, char *);
user_groups[0] = NULL;