summaryrefslogtreecommitdiff
path: root/run-command.c
diff options
context:
space:
mode:
Diffstat (limited to 'run-command.c')
-rw-r--r--run-command.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/run-command.c b/run-command.c
index 9942f120a9..0f41af3b55 100644
--- a/run-command.c
+++ b/run-command.c
@@ -213,8 +213,9 @@ static char *locate_in_PATH(const char *file)
static int exists_in_PATH(const char *file)
{
char *r = locate_in_PATH(file);
+ int found = r != NULL;
free(r);
- return r != NULL;
+ return found;
}
int sane_execvp(const char *file, char * const argv[])
@@ -420,12 +421,12 @@ static int prepare_cmd(struct argv_array *out, const struct child_process *cmd)
}
/*
- * If there are no '/' characters in the command then perform a path
- * lookup and use the resolved path as the command to exec. If there
- * are '/' characters, we have exec attempt to invoke the command
- * directly.
+ * If there are no dir separator characters in the command then perform
+ * a path lookup and use the resolved path as the command to exec. If
+ * there are dir separator characters, we have exec attempt to invoke
+ * the command directly.
*/
- if (!strchr(out->argv[1], '/')) {
+ if (!has_dir_sep(out->argv[1])) {
char *program = locate_in_PATH(out->argv[1]);
if (program) {
free((char *)out->argv[1]);