summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2016-07-31 08:05:15 +0000
committerEd Schouten <ed@FreeBSD.org>2016-07-31 08:05:15 +0000
commitac303f9771f5cc38cdbd2f9582ffda63e4acb578 (patch)
tree94ce608c10f0d02d93ebad84632bfce3cf33dba9
parenta7e4a908f3836e6eaf9e3023736bb26353f98c47 (diff)
downloadpw-darwin-ac303f9771f5cc38cdbd2f9582ffda63e4acb578.tar.gz
pw-darwin-ac303f9771f5cc38cdbd2f9582ffda63e4acb578.tar.zst
pw-darwin-ac303f9771f5cc38cdbd2f9582ffda63e4acb578.zip
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)
-rw-r--r--pw/pw_vpw.c5
-rw-r--r--pw/pwupd.h10
2 files changed, 3 insertions, 12 deletions
diff --git a/pw/pw_vpw.c b/pw/pw_vpw.c
index 8430113..58e5294 100644
--- a/pw/pw_vpw.c
+++ b/pw/pw_vpw.c
@@ -130,13 +130,10 @@ vendgrent(void)
}
}
-RET_SETGRENT
+void
vsetgrent(void)
{
vendgrent();
-#if defined(__FreeBSD__)
- return 0;
-#endif
}
static struct group *
diff --git a/pw/pwupd.h b/pw/pwupd.h
index 7fecffb..daca487 100644
--- a/pw/pwupd.h
+++ b/pw/pwupd.h
@@ -38,12 +38,6 @@
#include <stdbool.h>
#include <stringlist.h>
-#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 * nam);
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,