summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pw/grupd.c
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2015-07-03 14:22:44 +0000
committerbapt <bapt@FreeBSD.org>2015-07-03 14:22:44 +0000
commit9420a4ea0e57a8af4cb3a021b5529153fcb64251 (patch)
treed53116e1f843494918313336ade226a34d28f4f4 /usr.sbin/pw/grupd.c
parentaf3b3e839600760eccc5a9e28b4d86d1ee729b03 (diff)
downloadFreeBSD-src-9420a4ea0e57a8af4cb3a021b5529153fcb64251.zip
FreeBSD-src-9420a4ea0e57a8af4cb3a021b5529153fcb64251.tar.gz
MFC: r274011,r274022,r274453,r274542,r274632,r274727,r275653,r275656,r275657,
r275658,r275829,r277652,r277764,r278475,r278767,r278819,r278902,r279256, r282681,r282683,r282685,r282686,r282687,r282697,r282698,r282699,r282700, r282709,r282712,r282713,r282716,r282718,r282719,r282720,r282721,r283809, r283810,r283811,r283814,r283815,r283816,r283818,r283841,r283842,r283843, r283961,r283962,r284110,r284111,r284112,r284113,r284114,r284117,r284118, r284119,r284120,r284121,r284122,r284123,r284124,r284126,r284128,r284129, r284130,r284133,r284135,r284137,r284139,r284140,r284148,r284149,r284392 Lots of cleanup in the pw(8) code Add pw -R <rootdir> Add lots of regression tests More accurate error messages Approved by: re (kib) Sponsored by: gandi.net
Diffstat (limited to 'usr.sbin/pw/grupd.c')
-rw-r--r--usr.sbin/pw/grupd.c31
1 files changed, 5 insertions, 26 deletions
diff --git a/usr.sbin/pw/grupd.c b/usr.sbin/pw/grupd.c
index 3f78e95..d52a345 100644
--- a/usr.sbin/pw/grupd.c
+++ b/usr.sbin/pw/grupd.c
@@ -35,36 +35,18 @@ static const char rcsid[] =
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
-#include <stdarg.h>
-#include <sys/types.h>
-#include <sys/stat.h>
#include <sys/param.h>
#include "pwupd.h"
-static char * grpath = _PATH_PWD;
-
-int
-setgrdir(const char * dir)
-{
- if (dir == NULL)
- return -1;
- else
- grpath = strdup(dir);
- if (grpath == NULL)
- return -1;
-
- return 0;
-}
-
char *
getgrpath(const char * file)
{
static char pathbuf[MAXPATHLEN];
- snprintf(pathbuf, sizeof pathbuf, "%s/%s", grpath, file);
- return pathbuf;
+ snprintf(pathbuf, sizeof pathbuf, "%s/%s", conf.etcpath, file);
+
+ return (pathbuf);
}
static int
@@ -80,7 +62,7 @@ gr_update(struct group * grp, char const * group)
if (group != NULL)
old_gr = GETGRNAM(group);
- if (gr_init(grpath, NULL))
+ if (gr_init(conf.etcpath, NULL))
err(1, "gr_init()");
if ((pfd = gr_lock()) == -1) {
@@ -120,9 +102,6 @@ chggrent(char const * login, struct group * grp)
int
delgrent(struct group * grp)
{
- char group[MAXLOGNAME];
-
- strlcpy(group, grp->gr_name, MAXLOGNAME);
- return gr_update(NULL, group);
+ return (gr_update(NULL, grp->gr_name));
}
OpenPOWER on IntegriCloud