mirror of
https://github.com/open-simh/simtools.git
synced 2026-01-13 23:36:03 +00:00
Fix my_searchenv().
This commit is contained in:
parent
74c2399c7d
commit
1e9e8023b3
6
util.c
6
util.c
@ -131,7 +131,9 @@ void my_searchenv(
|
||||
{
|
||||
char *env;
|
||||
char *envcopy;
|
||||
char *envcopy2;
|
||||
char *cp;
|
||||
char *last;
|
||||
|
||||
*hitfile = 0; /* Default failure indication */
|
||||
|
||||
@ -157,7 +159,8 @@ void my_searchenv(
|
||||
argument. I don't want the return
|
||||
value from getenv destroyed. */
|
||||
|
||||
while ((cp = strtok(envcopy, PATHSEP)) != NULL) {
|
||||
envcopy2 = envcopy;
|
||||
while ((cp = strtok_r(envcopy2, PATHSEP, &last)) != NULL) {
|
||||
struct stat info;
|
||||
char *concat = malloc(strlen(cp) + strlen(name) + 2);
|
||||
|
||||
@ -177,6 +180,7 @@ void my_searchenv(
|
||||
free(envcopy);
|
||||
return;
|
||||
}
|
||||
envcopy2 = NULL;
|
||||
}
|
||||
|
||||
/* If I fall out of that loop, then hitfile indicates no match,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user