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
commita697e7c7ae3f57207a6ad6d016fafb4bd4edbed0 (patch)
tree50af2908e381b03974977649fd0dedb542c63475 /pw/pw.c
parente4061ea7d682a38b6ce4da1d45e20f840d367b19 (diff)
parent04c1a8669ab01c8bb76f4cbf48aa2f8c56fa80e9 (diff)
downloadpw-darwin-a697e7c7ae3f57207a6ad6d016fafb4bd4edbed0.tar.gz
pw-darwin-a697e7c7ae3f57207a6ad6d016fafb4bd4edbed0.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;