diff options
author | Mike Tancsa <mike@sentex.net> | 2017-03-31 22:50:35 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@users.noreply.github.com> | 2017-04-01 06:50:40 +0200 |
commit | 7e5b53972233b6aea593397ed8fb8f55068eadaf (patch) | |
tree | a7caf57de08ad3f3dc0735c423905b0ae134112e /lib/privs.c | |
parent | Merge pull request #307 from LabNConsulting/working/2.0/patch/rename2 (diff) | |
download | frr-7e5b53972233b6aea593397ed8fb8f55068eadaf.tar.xz frr-7e5b53972233b6aea593397ed8fb8f55068eadaf.zip |
lib: fix usage of getgrouplist() in *BSD
On BSD systems, the getgrouplist() function returns 0 if successful and
-1 on error.
Linux in the other hand returns *ngroups (the number of groups of which
user is a member) on success and -1 on error.
Given this difference, the most portable way to use getgrouplist()
is use its return value only for checking if it succeeded or not.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/privs.c')
-rw-r--r-- | lib/privs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/privs.c b/lib/privs.c index 376d6f336..decd4bb7d 100644 --- a/lib/privs.c +++ b/lib/privs.c @@ -731,7 +731,7 @@ zprivs_init(struct zebra_privs_t *zprivs) if (zprivs->user) { ngroups = sizeof(groups); - if ( (ngroups = getgrouplist (zprivs->user, zprivs_state.zgid, groups, &ngroups )) < 0 ) + if (getgrouplist (zprivs->user, zprivs_state.zgid, groups, &ngroups) < 0) { /* cant use log.h here as it depends on vty */ fprintf (stderr, "privs_init: could not getgrouplist for user %s\n", |