NetBSD Problem Report #47319

From www@NetBSD.org  Thu Dec 13 12:27:48 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 7EC6863E33E
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 13 Dec 2012 12:27:48 +0000 (UTC)
Message-Id: <20121213122747.8CBDB63E33E@www.NetBSD.org>
Date: Thu, 13 Dec 2012 12:27:47 +0000 (UTC)
From: henning.petersen@t-online.de
Reply-To: henning.petersen@t-online.de
To: gnats-bugs@NetBSD.org
Subject: Change type rval in grutil.c
X-Send-Pr-Version: www-1.0

>Number:         47319
>Category:       bin
>Synopsis:       Change type rval in grutil.c
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 13 12:30:00 +0000 2012
>Closed-Date:    Mon Jun 23 07:05:01 +0000 2014
>Last-Modified:  Mon Jun 23 07:05:01 +0000 2014
>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) {

>Release-Note:

>Audit-Trail:
From: "Mateusz Kocielski" <shm@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47319 CVS commit: src/usr.bin/newgrp
Date: Mon, 23 Jun 2014 06:57:31 +0000

 Module Name:	src
 Committed By:	shm
 Date:		Mon Jun 23 06:57:31 UTC 2014

 Modified Files:
 	src/usr.bin/newgrp: grutil.c

 Log Message:
 PR/47319 use addgrp_ret_t instead of magic values


 To generate a diff of this commit:
 cvs rdiff -u -r1.3 -r1.4 src/usr.bin/newgrp/grutil.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: shm@NetBSD.org
State-Changed-When: Mon, 23 Jun 2014 07:05:01 +0000
State-Changed-Why:
patch committed


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.