summaryrefslogtreecommitdiffstats
path: root/pw/pw.c
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2014-11-19 01:07:58 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2014-11-19 01:07:58 +0000
commit1191611aa1bf45ab42f08651b0234155c0e6605b (patch)
tree9a4c079f60ef6f050589283cb57661673c01fbc0 /pw/pw.c
parent094b0b77ca298c10cc5780f3b66e11010543325d (diff)
parent2beb8074e6d6662d92adb15321b33c20310152bd (diff)
downloadpw-darwin-1191611aa1bf45ab42f08651b0234155c0e6605b.tar.gz
pw-darwin-1191611aa1bf45ab42f08651b0234155c0e6605b.zip
Merge from head@274682
Diffstat (limited to 'pw/pw.c')
-rw-r--r--pw/pw.c8
1 files changed, 8 insertions, 0 deletions
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;