Commit 720653a3 by Richard Kenner

(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
parent 4d3cea21
...@@ -483,6 +483,11 @@ static struct path_prefix cpath, path; ...@@ -483,6 +483,11 @@ static struct path_prefix cpath, path;
static char *target_machine = TARGET_MACHINE; static char *target_machine = TARGET_MACHINE;
#endif #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 /* Search for NAME using prefix list PPREFIX. We only look for executable
files. files.
...@@ -519,14 +524,14 @@ find_a_file (pprefix, name) ...@@ -519,14 +524,14 @@ find_a_file (pprefix, name)
{ {
strcpy (temp, pl->prefix); strcpy (temp, pl->prefix);
strcat (temp, name); strcat (temp, name);
if (access (temp, X_OK) == 0) if (strcmp (temp, our_file_name) != 0 && access (temp, X_OK) == 0)
return temp; return temp;
#ifdef EXECUTABLE_SUFFIX #ifdef EXECUTABLE_SUFFIX
/* Some systems have a suffix for executable files. /* Some systems have a suffix for executable files.
So try appending that. */ So try appending that. */
strcat (temp, EXECUTABLE_SUFFIX); strcat (temp, EXECUTABLE_SUFFIX);
if (access (temp, X_OK) == 0) if (strcmp (temp, our_file_name) != 0 && access (temp, X_OK) == 0)
return temp; return temp;
#endif #endif
} }
...@@ -657,6 +662,8 @@ main (argc, argv) ...@@ -657,6 +662,8 @@ main (argc, argv)
vflag = 1; vflag = 1;
#endif #endif
our_file_name = argv[0];
p = (char *) getenv ("COLLECT_GCC_OPTIONS"); p = (char *) getenv ("COLLECT_GCC_OPTIONS");
if (p) if (p)
while (*p) while (*p)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment