summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuri Pankov <yuripv@FreeBSD.org>2018-10-16 16:00:41 +0000
committerYuri Pankov <yuripv@FreeBSD.org>2018-10-16 16:00:41 +0000
commitccc84708d81c35b2f56e57c1818bdebd12426d3c (patch)
tree7691978a55beb159f5c2d2b952fe55eecd891f22
parenteb33f7f73f5a9995d6c1a3eb23f0aaa2de310a2c (diff)
downloadpw-darwin-ccc84708d81c35b2f56e57c1818bdebd12426d3c.tar.gz
pw-darwin-ccc84708d81c35b2f56e57c1818bdebd12426d3c.tar.zst
pw-darwin-ccc84708d81c35b2f56e57c1818bdebd12426d3c.zip
pw: (file == NULL) check is always false in read_userconfig(), remove
it. Drop the now unused _PATH_PW_CONF definition. [1] While here, change the last remaining hardcoded "/etc" to _PATH_PWD. Noted by: glebius [1] Reviewed by: eugen Approved by: re (gjb), kib (mentor) Differential Revision: https://reviews.freebsd.org/D17575
-rw-r--r--pw/pw.c3
-rw-r--r--pw/pw.h1
-rw-r--r--pw/pw_conf.c3
3 files changed, 2 insertions, 5 deletions
diff --git a/pw/pw.c b/pw/pw.c
index 5f02a15..4f92034 100644
--- a/pw/pw.c
+++ b/pw/pw.c
@@ -162,7 +162,8 @@ main(int argc, char *argv[])
PWF._altdir = PWF_ROOTDIR;
}
snprintf(conf.etcpath, sizeof(conf.etcpath),
- "%s%s", optarg, arg == 'R' ? "/etc" : "");
+ "%s%s", optarg, arg == 'R' ?
+ _PATH_PWD : "");
} else
break;
}
diff --git a/pw/pw.h b/pw/pw.h
index d5e2c60..1e09722 100644
--- a/pw/pw.h
+++ b/pw/pw.h
@@ -65,7 +65,6 @@ enum _which
#define _DEF_DIRMODE (S_IRWXU | S_IRWXG | S_IRWXO)
#define _PW_CONF "pw.conf"
-#define _PATH_PW_CONF "/etc/pw.conf"
#define _UC_MAXLINE 1024
#define _UC_MAXSHELLS 32
diff --git a/pw/pw_conf.c b/pw/pw_conf.c
index f7b98f1..9dff3fe 100644
--- a/pw/pw_conf.c
+++ b/pw/pw_conf.c
@@ -255,9 +255,6 @@ read_userconfig(char const * file)
buf = NULL;
linecap = 0;
- if (file == NULL)
- file = _PATH_PW_CONF;
-
if ((fp = fopen(file, "r")) == NULL)
return (&config);