* cygcheck.cc (find_on_path): Create copy of rv on successful access

check, since rv can be reused in subsequent calls.
This commit is contained in:
Corinna Vinschen
2006-02-08 14:13:28 +00:00
parent 86fdf2166a
commit e699adfce5
2 changed files with 6 additions and 1 deletions

View File

@@ -275,7 +275,7 @@ find_on_path (char *file, char *default_extension,
return fn;
strcpy (rv, fn);
strcat (rv, default_extension);
return access (rv, F_OK) == 0 ? rv : fn;
return access (rv, F_OK) == 0 ? strdup (rv) : fn;
}
if (strchr (file, '.'))