2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 14:25:15 +00:00

find_path() changed since no more realpath()

This commit is contained in:
Todd C. Miller
1995-03-26 06:19:20 +00:00
parent d06e1f3ab2
commit 175390b58b

12
sudo.c
View File

@@ -76,6 +76,7 @@ static char rcsid[] = "$Id$";
#endif /* HAVE_MALLOC_H */
#include <pwd.h>
#include <netdb.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
@@ -534,19 +535,16 @@ static void add_env()
static void load_cmnd()
{
char path[MAXPATHLEN + 1];
if (strlen(Argv[1]) >= sizeof(path)) {
if (strlen(Argv[1]) > MAXPATHLEN) {
errno = ENAMETOOLONG;
(void) fprintf(stderr, "%s: %s: Pathname too long\n", Argv[0], Argv[1]);
exit(1);
}
(void) strcpy(path, Argv[1]);
/*
* Resolved the path (cmnd == resolved, ocmnd == unresolved).
* Resolve the path
*/
if (find_path(path, &cmnd, &ocmnd) == FALSE) {
if ((cmnd = find_path(Argv[1])) == NULL) {
(void) fprintf(stderr, "%s: %s: command not found\n", Argv[0], Argv[1]);
exit(1);
}