diff options
author | 2009-06-23 18:52:43 +0000 | |
---|---|---|
committer | 2009-06-23 18:52:43 +0000 | |
commit | 90dbde1ea0f935d195d180b701fafd7255b82806 (patch) | |
tree | 1dab22b4e7441f8bb502e60dd618b2adb993f7e1 /lib/libc/gen/getgrouplist.c | |
parent | tweak previous; (diff) | |
download | wireguard-openbsd-90dbde1ea0f935d195d180b701fafd7255b82806.tar.xz wireguard-openbsd-90dbde1ea0f935d195d180b701fafd7255b82806.zip |
getgrouplist(3) used to and ought to return 0 on success;
fixing a regression introduced in rev. 1.16 spotted by otto@;
ok millert@ otto@
Diffstat (limited to 'lib/libc/gen/getgrouplist.c')
-rw-r--r-- | lib/libc/gen/getgrouplist.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/libc/gen/getgrouplist.c b/lib/libc/gen/getgrouplist.c index 9b3d5fff649..d8dff264d8a 100644 --- a/lib/libc/gen/getgrouplist.c +++ b/lib/libc/gen/getgrouplist.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getgrouplist.c,v 1.17 2009/06/03 16:02:44 schwarze Exp $ */ +/* $OpenBSD: getgrouplist.c,v 1.18 2009/06/23 18:52:43 schwarze Exp $ */ /* * Copyright (c) 2008 Ingo Schwarze <schwarze@usta.de> * Copyright (c) 1991, 1993 @@ -209,16 +209,24 @@ getgrouplist(const char *uname, gid_t agroup, gid_t *groups, int *grpcnt) goto out; /* First scan the static netid file. */ - if (ret = _read_netid(key, pwstore.pw_uid, - groups, &ngroups, maxgroups)) + switch (_read_netid(key, pwstore.pw_uid, + groups, &ngroups, maxgroups)) { + case -1: + ret = -1; + /* FALLTHROUGH */ + case 1: goto out; + default: + break; + } /* Only access YP when there is no static entry. */ if (!yp_bind(__ypdomain) && !yp_match(__ypdomain, "netid.byname", key, (int)strlen(key), &ypdata, &ypdatalen)) - ret = _parse_netid(ypdata, pwstore.pw_uid, - groups, &ngroups, maxgroups); + if (_parse_netid(ypdata, pwstore.pw_uid, + groups, &ngroups, maxgroups) == -1) + ret = -1; free(key); free(ypdata); |