diff options
author | Theodore Ts'o <tytso@mit.edu> | 2016-03-29 20:48:05 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2016-03-30 10:14:16 +0200 |
commit | feca6d2e55d992bbe176ee8faa734c105eb1b2e1 (patch) | |
tree | cd69ac17088d2bc472e494758b2b7421aaa5098c | |
parent | f30e1ada8326463cc0af048afa058bc2f1dc9370 (diff) | |
download | linuxquota-feca6d2e55d992bbe176ee8faa734c105eb1b2e1.tar.gz |
Use NGROUPS_MAX instead of NGROUPS
NGRROUPS_MAX is what is defined by SuSv3; NGROUPS is not guaranteed by
any standard, but is just an ancient BSD'ism. Since Android's bionic
libc has the former but not the latter, let's use NGROUPS_MAX instead.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r-- | quota.c | 5 | ||||
-rw-r--r-- | quotaops.c | 5 |
2 files changed, 6 insertions, 4 deletions
@@ -48,6 +48,7 @@ #include <errno.h> #include <string.h> #include <unistd.h> +#include <limits.h> #ifdef RPC #include <rpc/rpc.h> #include "rquota.h" @@ -296,7 +297,7 @@ static int showquotas(int type, qid_t id, int mntcnt, char **mnt) int main(int argc, char **argv) { int ngroups; - gid_t gidset[NGROUPS], *gidsetp; + gid_t gidset[NGROUPS_MAX], *gidsetp; int i, ret; struct option long_opts[] = { { "help", 0, NULL, 'h' }, @@ -405,7 +406,7 @@ int main(int argc, char **argv) ret |= showquotas(USRQUOTA, getuid(), argc, argv); if (flags & FL_GROUP) { ngroups = sysconf(_SC_NGROUPS_MAX); - if (ngroups > NGROUPS) { + if (ngroups > NGROUPS_MAX) { gidsetp = malloc(ngroups * sizeof(gid_t)); if (!gidsetp) die(1, _("Gid set allocation (%d): %s\n"), ngroups, strerror(errno)); @@ -51,6 +51,7 @@ #include <unistd.h> #include <time.h> #include <ctype.h> +#include <limits.h> #if defined(RPC) #include "rquota.h" @@ -97,7 +98,7 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int quiet) #if defined(BSD_BEHAVIOUR) int j, ngroups; uid_t euid; - gid_t gidset[NGROUPS], *gidsetp; + gid_t gidset[NGROUPS_MAX], *gidsetp; #endif for (i = 0; handles[i]; i++) { @@ -115,7 +116,7 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int quiet) if (geteuid() == 0) break; ngroups = sysconf(_SC_NGROUPS_MAX); - if (ngroups > NGROUPS) { + if (ngroups > NGROUPS_MAX) { gidsetp = malloc(ngroups * sizeof(gid_t)); if (!gidsetp) { gid2group(id, name); |