summaryrefslogtreecommitdiffstats
path: root/pw
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
commit54a011838a76f1406af6edea1f1b2741105c5b80 (patch)
tree0a1771f52aa9a90ad781b3924adc7f280aa38ae6 /pw
parent12fdc6f764afc6d80bb949313c1dcb6739c909fb (diff)
downloadpw-darwin-54a011838a76f1406af6edea1f1b2741105c5b80.tar.gz
pw-darwin-54a011838a76f1406af6edea1f1b2741105c5b80.tar.zst
pw-darwin-54a011838a76f1406af6edea1f1b2741105c5b80.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)
Diffstat (limited to 'pw')
-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,