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 ocaml#10063.
  • Loading branch information
xavierleroy authored and dbuenzli committed Mar 25, 2021
1 parent fcdf394 commit cfeca2f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion otherlibs/unix/execvp.c
Original file line number Diff line number Diff line change
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 cfeca2f

Please sign in to comment.