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>
#define DBTRFS_SUBVOLUME_HOME "BTRFS_SUBVOLUME_HOME"
#define DLOG_INIT "LOG_INIT"
+#ifndef NGROUPS_MAX
+#define NGROUPS_MAX 65536
+#endif
+
/* local function prototypes */
NORETURN static void fail_exit (int, bool);
static void get_defaults(const struct option_flags *);
#endif
sys_ngroups = sysconf (_SC_NGROUPS_MAX);
+ if (sys_ngroups == -1)
+ sys_ngroups = NGROUPS_MAX;
user_groups = xmalloc_T(1 + sys_ngroups, char *);
/*
* Initialize the list to be empty