From 229f1c5662a4b35f0e78f947120ebd810d45ce20 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Sun, 31 May 2015 10:14:13 +0000 Subject: Remove uneeded intermediate variable --- pw/grupd.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'pw/grupd.c') diff --git a/pw/grupd.c b/pw/grupd.c index 74cc390..8735831 100644 --- a/pw/grupd.c +++ b/pw/grupd.c @@ -116,9 +116,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)); } -- cgit v1.2.3 From 39d77815028ba1a72509c07e0a8583493f6ec0a8 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Sun, 7 Jun 2015 14:34:38 +0000 Subject: Add a new global struct pwconf to store etcpath, rootdir and struct userconf Do not add anymore -R and -V to arglist Add an error message if both -V and -R are set in arguments --- pw/grupd.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'pw/grupd.c') diff --git a/pw/grupd.c b/pw/grupd.c index 8735831..d52a345 100644 --- a/pw/grupd.c +++ b/pw/grupd.c @@ -39,28 +39,14 @@ static const char rcsid[] = #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 @@ -76,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) { -- cgit v1.2.3