chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
dfecc42
)
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
Sven Eden
<yamakuzure@gmx.net>
Wed, 30 May 2018 05:49:52 +0000
(07:49 +0200)
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 ee42b10cbc9c74875496e45328ae1803eb2f78fd..3f364b3b3a8622b9b58737554e5f6a848c780b44 100644
(file)
--- a/
src/basic/user-util.c
+++ b/
src/basic/user-util.c
@@
-363,8
+363,9
@@
char* gid_to_name(gid_t gid) {
#if 0 /// UNNEEDED by elogind
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;
@@
-378,7
+379,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)