projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
43f2c88
)
user-util: minor updates of in_gid()
author
Lennart Poettering
<lennart@poettering.net>
Sat, 30 Dec 2017 13:05:41 +0000
(14:05 +0100)
committer
Lennart Poettering
<lennart@poettering.net>
Thu, 4 Jan 2018 12:27:27 +0000
(13:27 +0100)
Let's use newa() and use the right type for storing sysconf() return
values.
src/basic/user-util.c
patch
|
blob
|
history
diff --git
a/src/basic/user-util.c
b/src/basic/user-util.c
index
abb0b76
..
b99775c
100644
(file)
--- a/
src/basic/user-util.c
+++ b/
src/basic/user-util.c
@@
-358,8
+358,9
@@
char* gid_to_name(gid_t gid) {
}
int in_gid(gid_t gid) {
+ long ngroups_max;
gid_t *gids;
- int
ngroups_max,
r, i;
+ int r, i;
if (getgid() == gid)
return 1;
@@
-373,7
+374,7
@@
int in_gid(gid_t gid) {
ngroups_max = sysconf(_SC_NGROUPS_MAX);
assert(ngroups_max > 0);
- gids =
alloca(sizeof(gid_t) *
ngroups_max);
+ gids =
newa(gid_t,
ngroups_max);
r = getgroups(ngroups_max, gids);
if (r < 0)