summaryrefslogtreecommitdiffstats
path: root/pw
diff options
context:
space:
mode:
authorGlen Barber <gjb@FreeBSD.org>2015-01-19 16:15:12 +0000
committerGlen Barber <gjb@FreeBSD.org>2015-01-19 16:15:12 +0000
commitdb1f3ef7198abe032b976685c9cf46470e306f9c (patch)
treec53ce6ec7a67c8ed74107726776049bf688f7858 /pw
parent8c4532e1189f5ef981aff455332acbfbb082cfa9 (diff)
parentf3f1481c2b79a9f8747738acd08571ab4c50eb3a (diff)
downloadpw-darwin-db1f3ef7198abe032b976685c9cf46470e306f9c.tar.gz
pw-darwin-db1f3ef7198abe032b976685c9cf46470e306f9c.zip
Reintegrate head: r274132-r277384
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'pw')
-rw-r--r--pw/Makefile3
-rw-r--r--pw/pw.c8
2 files changed, 9 insertions, 2 deletions
diff --git a/pw/Makefile b/pw/Makefile
index 8c5acf9..269b145 100644
--- a/pw/Makefile
+++ b/pw/Makefile
@@ -8,8 +8,7 @@ SRCS= pw.c pw_conf.c pw_user.c pw_group.c pw_log.c pw_nis.c pw_vpw.c \
WARNS?= 2
-DPADD= ${LIBCRYPT} ${LIBUTIL}
-LDADD= -lcrypt -lutil
+LIBADD= crypt util
.include <src.opts.mk>
diff --git a/pw/pw.c b/pw/pw.c
index b0ac728..ff48db7 100644
--- a/pw/pw.c
+++ b/pw/pw.c
@@ -98,6 +98,7 @@ main(int argc, char *argv[])
int which = -1;
char *config = NULL;
struct userconf *cnf;
+ struct stat st;
static const char *opts[W_NUM][M_NUM] =
{
@@ -143,6 +144,13 @@ main(int argc, char *argv[])
if (argv[1][1] == 'V') {
optarg = &argv[1][2];
if (*optarg == '\0') {
+ if (stat(argv[2], &st) != 0)
+ errx(EX_OSFILE, \
+ "no such directory `%s'",
+ argv[2]);
+ if (!S_ISDIR(st.st_mode))
+ errx(EX_OSFILE, "`%s' not a "
+ "directory", argv[2]);
optarg = argv[2];
++argv;
--argc;