NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/47319: Change type rval in grutil.c



>Number:         47319
>Category:       bin
>Synopsis:       Change type rval in grutil.c
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 13 12:30:00 +0000 2012
>Originator:     Henning Petersen
>Release:        NetBSD-current
>Organization:
>Environment:
>Description:
Change type of rval from int to addgrp_ret_t.
>How-To-Repeat:

>Fix:
diff -u -p -r1.2 grutil.c
--- usr.bin/newgrp/grutil.c     28 Apr 2008 20:24:14 -0000      1.2
+++ usr.bin/newgrp/grutil.c     9 Dec 2012 07:37:37 -0000
@@ -137,7 +137,8 @@ addgid(gid_t *groups, int ngroups, int n
 static addgrp_ret_t
 addgrp(gid_t newgid, int makespace)
 {
-       int ngroups, ngroupsmax, rval;
+       int ngroups, ngroupsmax; 
+       addgrp_ret_t rval;
        gid_t *groups;
        gid_t oldgid;
 
@@ -146,7 +147,7 @@ addgrp(gid_t newgid, int makespace)
                return ADDGRP_NOERROR;
 
        rval = alloc_groups(&ngroups, &groups, &ngroupsmax);
-       if (rval != 0)
+       if (rval != ADDGRP_NOERROR)
                return rval;
 
        /*
@@ -234,7 +235,7 @@ newgrp(const char *gname, struct passwd 
        if (ruid == 0 || pwd->pw_gid == grp->gr_gid)
                return grp->gr_gid;
 
-       if (alloc_groups(&ngroups, &groups, &ngroupsmax) == 0) {
+       if (alloc_groups(&ngroups, &groups, &ngroupsmax) == ADDGRP_NOERROR) {
                int i;
                for (i = 0; i < ngroups; i++)
                        if (groups[i] == grp->gr_gid) {



Home | Main Index | Thread Index | Old Index