summaryrefslogtreecommitdiffstats
path: root/pw/grupd.c
diff options
context:
space:
mode:
Diffstat (limited to 'pw/grupd.c')
-rw-r--r--pw/grupd.c35
1 files changed, 6 insertions, 29 deletions
diff --git a/pw/grupd.c b/pw/grupd.c
index 3f78e95..9cbe0cb 100644
--- a/pw/grupd.c
+++ b/pw/grupd.c
@@ -29,42 +29,22 @@ static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */
+#include <err.h>
#include <grp.h>
#include <libutil.h>
-#include <err.h>
#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 +60,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 +100,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));
}