diff options
author | Alex Feldman <alex@cvs.openbsd.org> | 1999-04-21 21:15:13 +0000 |
---|---|---|
committer | Alex Feldman <alex@cvs.openbsd.org> | 1999-04-21 21:15:13 +0000 |
commit | 38ac9a45756cb4bec3307f726cfb885407bc8daa (patch) | |
tree | afcddc9f17107eb4086c12a4f2dcf18af246bdb8 /usr.sbin | |
parent | 02d6cbb92ecc1d5eb801c4278ffd087506a18692 (diff) |
Don't display the string associated with errno for "basedir too long"
diagnostic.
Issue a diagnostic message if the master.passwd file isn't specified as an
absolute path.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pwd_mkdb/pwd_mkdb.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.c b/usr.sbin/pwd_mkdb/pwd_mkdb.c index 5409337817f..0424c963381 100644 --- a/usr.sbin/pwd_mkdb/pwd_mkdb.c +++ b/usr.sbin/pwd_mkdb/pwd_mkdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pwd_mkdb.c,v 1.19 1998/07/15 19:33:28 millert Exp $ */ +/* $OpenBSD: pwd_mkdb.c,v 1.20 1999/04/21 21:15:12 alex Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -45,7 +45,7 @@ static char copyright[] = #if 0 static char sccsid[] = "from: @(#)pwd_mkdb.c 8.5 (Berkeley) 4/20/94"; #else -static char *rcsid = "$OpenBSD: pwd_mkdb.c,v 1.19 1998/07/15 19:33:28 millert Exp $"; +static char *rcsid = "$OpenBSD: pwd_mkdb.c,v 1.20 1999/04/21 21:15:12 alex Exp $"; #endif #endif /* not lint */ @@ -120,7 +120,7 @@ main(argc, argv) case 'd': basedir = optarg; if (strlen(basedir) > MAXPATHLEN - 40) - error("basedir too long"); + errx(1, "basedir too long"); break; case '?': default: @@ -147,6 +147,9 @@ main(argc, argv) /* We don't care what the user wants. */ (void)umask(0); + if (**argv != '/') + errx(1, "%s must be specified as an absolute path", *argv); + pname = strdup(changedir(*argv, basedir)); /* Open the original password file */ if (!(fp = fopen(pname, "r"))) |