diff options
author | Alexey Gladkov <legion@altlinux.org> | 2006-10-13 22:58:46 +1000 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2006-10-13 22:58:46 +1000 |
commit | 1a33ea8ff7736fc63f0c7be2c3a8b488e572694d (patch) | |
tree | fd93c352efd0de3cdd1e2758e291b378578c404c /src/bltin | |
parent | [EXPAND] Fixed inverted char class matching (diff) | |
download | dash-1a33ea8ff7736fc63f0c7be2c3a8b488e572694d.tar.gz dash-1a33ea8ff7736fc63f0c7be2c3a8b488e572694d.zip |
[SYSTEM] Check return code for getgroups and fwrite
Check getgroups() and fwrite() return code, required to build with -D_FORTIFY_SOURCE=2.
Diffstat (limited to 'src/bltin')
-rw-r--r-- | src/bltin/test.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/bltin/test.c b/src/bltin/test.c index 9b09094..f16c819 100644 --- a/src/bltin/test.c +++ b/src/bltin/test.c @@ -489,7 +489,8 @@ bash_group_member(gid_t gid) ngroups = getgroups(0, NULL); group_array = stalloc(ngroups * sizeof(gid_t)); - getgroups(ngroups, group_array); + if ((getgroups(ngroups, group_array)) != ngroups) + return (0); /* Search through the list looking for GID. */ for (i = 0; i < ngroups; i++) |