diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1993-01-22 07:56:23 -0500 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1993-01-22 07:56:23 -0500 |
commit | 720653a39b081dad186c39084176c29c8ed4b6ed (patch) | |
tree | 1205f2c07f1379a22ab22a1a23eeb7517c3e4483 | |
parent | 4d3cea21c7753c244069178c956b5fa8bec73bc6 (diff) | |
download | gcc-720653a39b081dad186c39084176c29c8ed4b6ed.zip gcc-720653a39b081dad186c39084176c29c8ed4b6ed.tar.gz gcc-720653a39b081dad186c39084176c29c8ed4b6ed.tar.bz2 |
(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
-rw-r--r-- | gcc/collect2.c | 11 |
1 files 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) |