From owner-svn-src-all@freebsd.org Sun Jul 31 08:05:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5F40BAACA2; Sun, 31 Jul 2016 08:05:16 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 77B6011C3; Sun, 31 Jul 2016 08:05:16 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6V85Fac052203; Sun, 31 Jul 2016 08:05:15 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6V85FtQ052198; Sun, 31 Jul 2016 08:05:15 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201607310805.u6V85FtQ052198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Sun, 31 Jul 2016 08:05:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303580 - in head: include lib/libc/gen usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jul 2016 08:05:16 -0000 Author: ed Date: Sun Jul 31 08:05:15 2016 New Revision: 303580 URL: https://svnweb.freebsd.org/changeset/base/303580 Log: Fix up setgrent(3) to have a POSIX-compliant prototype. Just like with freelocale(3), I haven't been able to find any piece of code that actually makes use of this function's return value, both in base and in ports. The reason for this is that FreeBSD seems to be the only operating system to have such a prototype. This is why I'm deciding to not use symbol versioning for this. It does seem that the pw(8) utility depends on the function's typing and already had a switch in place to toggle between the FreeBSD and POSIX variant of this function. Clean this up by always expecting the POSIX variant. There is also a single port that has a couple of local declarations of setgrent(3) that need to be patched up. This is in the process of being fixed. PR: 211394 (exp-run) Modified: head/include/grp.h head/lib/libc/gen/getgrent.3 head/lib/libc/gen/getgrent.c head/usr.sbin/pw/pw_vpw.c head/usr.sbin/pw/pwupd.h Modified: head/include/grp.h ============================================================================== --- head/include/grp.h Sun Jul 31 06:53:50 2016 (r303579) +++ head/include/grp.h Sun Jul 31 08:05:15 2016 (r303580) @@ -75,8 +75,7 @@ int pwcache_groupdb(int (*)(int), void struct group * (*)(gid_t)); #endif #if __XSI_VISIBLE -/* XXX IEEE Std 1003.1, 2003 specifies `void setgrent(void)' */ -int setgrent(void); +void setgrent(void); #endif #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE int getgrgid_r(gid_t, struct group *, char *, size_t, Modified: head/lib/libc/gen/getgrent.3 ============================================================================== --- head/lib/libc/gen/getgrent.3 Sun Jul 31 06:53:50 2016 (r303579) +++ head/lib/libc/gen/getgrent.3 Sun Jul 31 08:05:15 2016 (r303580) @@ -28,7 +28,7 @@ .\" From: @(#)getgrent.3 8.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd April 16, 2003 +.Dd July 31, 2016 .Dt GETGRENT 3 .Os .Sh NAME @@ -60,7 +60,7 @@ .Fn getgrgid_r "gid_t gid" "struct group *grp" "char *buffer" "size_t bufsize" "struct group **result" .Ft int .Fn setgroupent "int stayopen" -.Ft int +.Ft void .Fn setgrent void .Ft void .Fn endgrent void @@ -188,14 +188,13 @@ is set to .Dv NULL and the return value is 0, no matching entry exists.) .Pp -The functions +The function .Fn setgroupent -and -.Fn setgrent -return the value 1 if successful, otherwise the value +returns the value 1 if successful, otherwise the value 0 is returned. The functions -.Fn endgrent +.Fn endgrent , +.Fn setgrent and .Fn setgrfile have no return value. Modified: head/lib/libc/gen/getgrent.c ============================================================================== --- head/lib/libc/gen/getgrent.c Sun Jul 31 06:53:50 2016 (r303579) +++ head/lib/libc/gen/getgrent.c Sun Jul 31 08:05:15 2016 (r303580) @@ -533,12 +533,10 @@ out: return (rv); } -/* XXX IEEE Std 1003.1, 2003 specifies `void setgrent(void)' */ -int +void setgrent(void) { (void)_nsdispatch(NULL, setgrent_dtab, NSDB_GROUP, "setgrent", defaultsrc, 0); - return (1); } Modified: head/usr.sbin/pw/pw_vpw.c ============================================================================== --- head/usr.sbin/pw/pw_vpw.c Sun Jul 31 06:53:50 2016 (r303579) +++ head/usr.sbin/pw/pw_vpw.c Sun Jul 31 08:05:15 2016 (r303580) @@ -130,13 +130,10 @@ vendgrent(void) } } -RET_SETGRENT +void vsetgrent(void) { vendgrent(); -#if defined(__FreeBSD__) - return 0; -#endif } static struct group * Modified: head/usr.sbin/pw/pwupd.h ============================================================================== --- head/usr.sbin/pw/pwupd.h Sun Jul 31 06:53:50 2016 (r303579) +++ head/usr.sbin/pw/pwupd.h Sun Jul 31 08:05:15 2016 (r303580) @@ -38,12 +38,6 @@ #include #include -#if defined(__FreeBSD__) -#define RET_SETGRENT int -#else -#define RET_SETGRENT void -#endif - struct pwf { int _altdir; void (*_setpwent)(void); @@ -51,7 +45,7 @@ struct pwf { struct passwd * (*_getpwent)(void); struct passwd * (*_getpwuid)(uid_t uid); struct passwd * (*_getpwnam)(const char * nam); - RET_SETGRENT (*_setgrent)(void); + void (*_setgrent)(void); void (*_endgrent)(void); struct group * (*_getgrent)(void); struct group * (*_getgrgid)(gid_t gid); @@ -141,7 +135,7 @@ struct passwd * vgetpwnam(const char * n struct group * vgetgrent(void); struct group * vgetgrgid(gid_t gid); struct group * vgetgrnam(const char * nam); -RET_SETGRENT vsetgrent(void); +void vsetgrent(void); void vendgrent(void); void copymkdir(int rootfd, char const * dir, int skelfd, mode_t mode, uid_t uid,