diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2003-04-03 19:15:35 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2003-04-03 19:15:35 +0000 |
commit | 7d1bac92416230d9ee85e1a890ead0683d0948f6 (patch) | |
tree | efd7bd51fa1e440c0cf7c099ebc14195ff0b333a /usr.bin/sudo/find_path.c | |
parent | a8c1bd16fee3bf5fff45987e8ba0ef7a281ede93 (diff) |
Sync with my sudo cvs repo:
o update to sudo 1.6.7p2
o use warn/err throughout
Diffstat (limited to 'usr.bin/sudo/find_path.c')
-rw-r--r-- | usr.bin/sudo/find_path.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/usr.bin/sudo/find_path.c b/usr.bin/sudo/find_path.c index 7288b6afa15..205bf77354c 100644 --- a/usr.bin/sudo/find_path.c +++ b/usr.bin/sudo/find_path.c @@ -56,12 +56,16 @@ #ifdef HAVE_UNISTD_H # include <unistd.h> #endif /* HAVE_UNISTD_H */ -#include <errno.h> +#ifdef HAVE_ERR_H +# include <err.h> +#else +# include "emul/err.h" +#endif /* HAVE_ERR_H */ #include "sudo.h" #ifndef lint -static const char rcsid[] = "$Sudo: find_path.c,v 1.101 2003/03/15 20:31:02 millert Exp $"; +static const char rcsid[] = "$Sudo: find_path.c,v 1.102 2003/04/02 18:25:19 millert Exp $"; #endif /* lint */ /* @@ -84,10 +88,8 @@ find_path(infile, outfile, path) int checkdot = 0; /* check current dir? */ int len; /* length parameter */ - if (strlen(infile) >= MAXPATHLEN) { - (void) fprintf(stderr, "%s: path too long: %s\n", Argv[0], infile); - exit(1); - } + if (strlen(infile) >= MAXPATHLEN) + errx(1, "%s: File name too long", infile); /* * If we were given a fully qualified or relative path @@ -130,10 +132,8 @@ find_path(infile, outfile, path) * Resolve the path and exit the loop if found. */ len = snprintf(command, sizeof(command), "%s/%s", path, infile); - if (len <= 0 || len >= sizeof(command)) { - (void) fprintf(stderr, "%s: path too long: %s\n", Argv[0], infile); - exit(1); - } + if (len <= 0 || len >= sizeof(command)) + errx(1, "%s: File name too long", infile); if ((result = sudo_goodpath(command))) break; |