diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-06-07 14:34:38 +0000 |
---|---|---|
committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-06-07 14:34:38 +0000 |
commit | 9abed571e35148d563a116eca8c222a7afa18adc (patch) | |
tree | 5eeab2ebb6b54baad8fd66879aa383260489baaa /pw/grupd.c | |
parent | 64c0761c094841650f4a2f526423c5e0116b5425 (diff) | |
download | pw-darwin-9abed571e35148d563a116eca8c222a7afa18adc.tar.gz pw-darwin-9abed571e35148d563a116eca8c222a7afa18adc.tar.zst pw-darwin-9abed571e35148d563a116eca8c222a7afa18adc.zip |
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
Diffstat (limited to 'pw/grupd.c')
-rw-r--r-- | pw/grupd.c | 22 |
1 files changed, 4 insertions, 18 deletions
@@ -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) { |