diff options
Diffstat (limited to 'meta/recipes-extended/quota/quota/0001-Use-NGROUPS_MAX-instead-of-NGROUPS.patch')
-rw-r--r-- | meta/recipes-extended/quota/quota/0001-Use-NGROUPS_MAX-instead-of-NGROUPS.patch | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/meta/recipes-extended/quota/quota/0001-Use-NGROUPS_MAX-instead-of-NGROUPS.patch b/meta/recipes-extended/quota/quota/0001-Use-NGROUPS_MAX-instead-of-NGROUPS.patch new file mode 100644 index 0000000000..6fb2daf532 --- /dev/null +++ b/meta/recipes-extended/quota/quota/0001-Use-NGROUPS_MAX-instead-of-NGROUPS.patch | |||
@@ -0,0 +1,83 @@ | |||
1 | Upstream-Status: Backport | ||
2 | |||
3 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
4 | --- | ||
5 | From feca6d2e55d992bbe176ee8faa734c105eb1b2e1 Mon Sep 17 00:00:00 2001 | ||
6 | From: Theodore Ts'o <tytso@mit.edu> | ||
7 | Date: Tue, 29 Mar 2016 20:48:05 -0400 | ||
8 | Subject: [PATCH] Use NGROUPS_MAX instead of NGROUPS | ||
9 | |||
10 | NGRROUPS_MAX is what is defined by SuSv3; NGROUPS is not guaranteed by | ||
11 | any standard, but is just an ancient BSD'ism. Since Android's bionic | ||
12 | libc has the former but not the latter, let's use NGROUPS_MAX instead. | ||
13 | |||
14 | Signed-off-by: Theodore Ts'o <tytso@mit.edu> | ||
15 | Signed-off-by: Jan Kara <jack@suse.cz> | ||
16 | --- | ||
17 | quota.c | 5 +++-- | ||
18 | quotaops.c | 5 +++-- | ||
19 | 2 files changed, 6 insertions(+), 4 deletions(-) | ||
20 | |||
21 | diff --git a/quota.c b/quota.c | ||
22 | index 049dac4..e195ead 100644 | ||
23 | --- a/quota.c | ||
24 | +++ b/quota.c | ||
25 | @@ -48,6 +48,7 @@ | ||
26 | #include <errno.h> | ||
27 | #include <string.h> | ||
28 | #include <unistd.h> | ||
29 | +#include <limits.h> | ||
30 | #ifdef RPC | ||
31 | #include <rpc/rpc.h> | ||
32 | #include "rquota.h" | ||
33 | @@ -296,7 +297,7 @@ static int showquotas(int type, qid_t id, int mntcnt, char **mnt) | ||
34 | int main(int argc, char **argv) | ||
35 | { | ||
36 | int ngroups; | ||
37 | - gid_t gidset[NGROUPS], *gidsetp; | ||
38 | + gid_t gidset[NGROUPS_MAX], *gidsetp; | ||
39 | int i, ret; | ||
40 | struct option long_opts[] = { | ||
41 | { "help", 0, NULL, 'h' }, | ||
42 | @@ -405,7 +406,7 @@ int main(int argc, char **argv) | ||
43 | ret |= showquotas(USRQUOTA, getuid(), argc, argv); | ||
44 | if (flags & FL_GROUP) { | ||
45 | ngroups = sysconf(_SC_NGROUPS_MAX); | ||
46 | - if (ngroups > NGROUPS) { | ||
47 | + if (ngroups > NGROUPS_MAX) { | ||
48 | gidsetp = malloc(ngroups * sizeof(gid_t)); | ||
49 | if (!gidsetp) | ||
50 | die(1, _("Gid set allocation (%d): %s\n"), ngroups, strerror(errno)); | ||
51 | diff --git a/quotaops.c b/quotaops.c | ||
52 | index 136aec3..590dc1b 100644 | ||
53 | --- a/quotaops.c | ||
54 | +++ b/quotaops.c | ||
55 | @@ -51,6 +51,7 @@ | ||
56 | #include <unistd.h> | ||
57 | #include <time.h> | ||
58 | #include <ctype.h> | ||
59 | +#include <limits.h> | ||
60 | |||
61 | #if defined(RPC) | ||
62 | #include "rquota.h" | ||
63 | @@ -97,7 +98,7 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int quiet) | ||
64 | #if defined(BSD_BEHAVIOUR) | ||
65 | int j, ngroups; | ||
66 | uid_t euid; | ||
67 | - gid_t gidset[NGROUPS], *gidsetp; | ||
68 | + gid_t gidset[NGROUPS_MAX], *gidsetp; | ||
69 | #endif | ||
70 | |||
71 | for (i = 0; handles[i]; i++) { | ||
72 | @@ -115,7 +116,7 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int quiet) | ||
73 | if (geteuid() == 0) | ||
74 | break; | ||
75 | ngroups = sysconf(_SC_NGROUPS_MAX); | ||
76 | - if (ngroups > NGROUPS) { | ||
77 | + if (ngroups > NGROUPS_MAX) { | ||
78 | gidsetp = malloc(ngroups * sizeof(gid_t)); | ||
79 | if (!gidsetp) { | ||
80 | gid2group(id, name); | ||
81 | -- | ||
82 | 2.6.1 | ||
83 | |||