Skip to content

Commit

Permalink
Use strchr() instead of index()
Browse files Browse the repository at this point in the history
strchr() is standard and declared in <string.h>.
index() is legacy and declared in <strings.h>, which we don't include.
The discrepancy was found on Solaris as part of #10063.

Cherry-picked fro 9eb015e in 4.12 by
Sébastien Hinderer.
  • Loading branch information
xavierleroy authored and shindere committed Jan 28, 2021
1 parent 480ccf9 commit 9ef0e56
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion otherlibs/unix/execvp.c
Expand Up @@ -106,7 +106,7 @@ int unix_execvpe_emulation(const char * name,
int r, got_eacces;

/* If name contains a '/', do not search in path */
if (index(name, '/') != NULL) return unix_execve_script(name, argv, envp);
if (strchr(name, '/') != NULL) return unix_execve_script(name, argv, envp);
/* Determine search path */
searchpath = getenv("PATH");
if (searchpath == NULL) searchpath = "/bin:/usr/bin";
Expand Down

0 comments on commit 9ef0e56

Please sign in to comment.