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)
This commit is contained in:
parent
452ccc029f
commit
9c24291370
@ -75,8 +75,7 @@ int pwcache_groupdb(int (*)(int), void (*)(void),
|
|||||||
struct group * (*)(gid_t));
|
struct group * (*)(gid_t));
|
||||||
#endif
|
#endif
|
||||||
#if __XSI_VISIBLE
|
#if __XSI_VISIBLE
|
||||||
/* XXX IEEE Std 1003.1, 2003 specifies `void setgrent(void)' */
|
void setgrent(void);
|
||||||
int setgrent(void);
|
|
||||||
#endif
|
#endif
|
||||||
#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
|
#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
|
||||||
int getgrgid_r(gid_t, struct group *, char *, size_t,
|
int getgrgid_r(gid_t, struct group *, char *, size_t,
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
.\" From: @(#)getgrent.3 8.2 (Berkeley) 4/19/94
|
.\" From: @(#)getgrent.3 8.2 (Berkeley) 4/19/94
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd April 16, 2003
|
.Dd July 31, 2016
|
||||||
.Dt GETGRENT 3
|
.Dt GETGRENT 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -60,7 +60,7 @@
|
|||||||
.Fn getgrgid_r "gid_t gid" "struct group *grp" "char *buffer" "size_t bufsize" "struct group **result"
|
.Fn getgrgid_r "gid_t gid" "struct group *grp" "char *buffer" "size_t bufsize" "struct group **result"
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fn setgroupent "int stayopen"
|
.Fn setgroupent "int stayopen"
|
||||||
.Ft int
|
.Ft void
|
||||||
.Fn setgrent void
|
.Fn setgrent void
|
||||||
.Ft void
|
.Ft void
|
||||||
.Fn endgrent void
|
.Fn endgrent void
|
||||||
@ -188,14 +188,13 @@ is set to
|
|||||||
.Dv NULL
|
.Dv NULL
|
||||||
and the return value is 0, no matching entry exists.)
|
and the return value is 0, no matching entry exists.)
|
||||||
.Pp
|
.Pp
|
||||||
The functions
|
The function
|
||||||
.Fn setgroupent
|
.Fn setgroupent
|
||||||
and
|
returns the value 1 if successful, otherwise the value
|
||||||
.Fn setgrent
|
|
||||||
return the value 1 if successful, otherwise the value
|
|
||||||
0 is returned.
|
0 is returned.
|
||||||
The functions
|
The functions
|
||||||
.Fn endgrent
|
.Fn endgrent ,
|
||||||
|
.Fn setgrent
|
||||||
and
|
and
|
||||||
.Fn setgrfile
|
.Fn setgrfile
|
||||||
have no return value.
|
have no return value.
|
||||||
|
@ -533,12 +533,10 @@ out:
|
|||||||
return (rv);
|
return (rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX IEEE Std 1003.1, 2003 specifies `void setgrent(void)' */
|
void
|
||||||
int
|
|
||||||
setgrent(void)
|
setgrent(void)
|
||||||
{
|
{
|
||||||
(void)_nsdispatch(NULL, setgrent_dtab, NSDB_GROUP, "setgrent", defaultsrc, 0);
|
(void)_nsdispatch(NULL, setgrent_dtab, NSDB_GROUP, "setgrent", defaultsrc, 0);
|
||||||
return (1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -130,13 +130,10 @@ vendgrent(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RET_SETGRENT
|
void
|
||||||
vsetgrent(void)
|
vsetgrent(void)
|
||||||
{
|
{
|
||||||
vendgrent();
|
vendgrent();
|
||||||
#if defined(__FreeBSD__)
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct group *
|
static struct group *
|
||||||
|
@ -38,12 +38,6 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stringlist.h>
|
#include <stringlist.h>
|
||||||
|
|
||||||
#if defined(__FreeBSD__)
|
|
||||||
#define RET_SETGRENT int
|
|
||||||
#else
|
|
||||||
#define RET_SETGRENT void
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct pwf {
|
struct pwf {
|
||||||
int _altdir;
|
int _altdir;
|
||||||
void (*_setpwent)(void);
|
void (*_setpwent)(void);
|
||||||
@ -51,7 +45,7 @@ struct pwf {
|
|||||||
struct passwd * (*_getpwent)(void);
|
struct passwd * (*_getpwent)(void);
|
||||||
struct passwd * (*_getpwuid)(uid_t uid);
|
struct passwd * (*_getpwuid)(uid_t uid);
|
||||||
struct passwd * (*_getpwnam)(const char * nam);
|
struct passwd * (*_getpwnam)(const char * nam);
|
||||||
RET_SETGRENT (*_setgrent)(void);
|
void (*_setgrent)(void);
|
||||||
void (*_endgrent)(void);
|
void (*_endgrent)(void);
|
||||||
struct group * (*_getgrent)(void);
|
struct group * (*_getgrent)(void);
|
||||||
struct group * (*_getgrgid)(gid_t gid);
|
struct group * (*_getgrgid)(gid_t gid);
|
||||||
@ -141,7 +135,7 @@ struct passwd * vgetpwnam(const char * nam);
|
|||||||
struct group * vgetgrent(void);
|
struct group * vgetgrent(void);
|
||||||
struct group * vgetgrgid(gid_t gid);
|
struct group * vgetgrgid(gid_t gid);
|
||||||
struct group * vgetgrnam(const char * nam);
|
struct group * vgetgrnam(const char * nam);
|
||||||
RET_SETGRENT vsetgrent(void);
|
void vsetgrent(void);
|
||||||
void vendgrent(void);
|
void vendgrent(void);
|
||||||
|
|
||||||
void copymkdir(int rootfd, char const * dir, int skelfd, mode_t mode, uid_t uid,
|
void copymkdir(int rootfd, char const * dir, int skelfd, mode_t mode, uid_t uid,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user