From 720653a39b081dad186c39084176c29c8ed4b6ed Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Fri, 22 Jan 1993 07:56:23 -0500 Subject: [PATCH] (our_file_name): New variable. (find_a_file): Ignore filename equal to that in our_file_name. (main): Initialize our_file_name. From-SVN: r3299 --- gcc/collect2.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/collect2.c b/gcc/collect2.c index 6730401..2cd9b17 100644 --- a/gcc/collect2.c +++ b/gcc/collect2.c @@ -483,6 +483,11 @@ static struct path_prefix cpath, path; static char *target_machine = TARGET_MACHINE; #endif + +/* Name under which we were executed. Never return that file in our + searches. */ + +static char *our_file_name; /* Search for NAME using prefix list PPREFIX. We only look for executable files. @@ -519,14 +524,14 @@ find_a_file (pprefix, name) { strcpy (temp, pl->prefix); strcat (temp, name); - if (access (temp, X_OK) == 0) + if (strcmp (temp, our_file_name) != 0 && access (temp, X_OK) == 0) return temp; #ifdef EXECUTABLE_SUFFIX /* Some systems have a suffix for executable files. So try appending that. */ strcat (temp, EXECUTABLE_SUFFIX); - if (access (temp, X_OK) == 0) + if (strcmp (temp, our_file_name) != 0 && access (temp, X_OK) == 0) return temp; #endif } @@ -657,6 +662,8 @@ main (argc, argv) vflag = 1; #endif + our_file_name = argv[0]; + p = (char *) getenv ("COLLECT_GCC_OPTIONS"); if (p) while (*p) -- 2.7.4