diff options
Diffstat (limited to 'pw')
| -rw-r--r-- | pw/Makefile | 3 | ||||
| -rw-r--r-- | pw/pw.c | 8 |
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> @@ -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; |
