Skip to content
This repository has been archived by the owner on Oct 10, 2019. It is now read-only.

Commit

Permalink
Merge pull request #71 from edquist/no-cmd-expansion
Browse files Browse the repository at this point in the history
tell wordexp not to do command substitution
  • Loading branch information
brianhlin authored Jun 6, 2018
2 parents 1f6ad40 + 7148c91 commit 1a8f6f5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/blparser_master.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,18 @@ check_on_children_args(const struct blah_managed_child *children, const int coun
fret = fork();
if (fret == 0)
{
if((j = wordexp(children[i].exefile, &args, 0)))
if((j = wordexp(children[i].exefile, &args, WRDE_NOCMD)))
{
fprintf(stderr,"wordexp: unable to parse the command line \"%s\" (error %d)\n", children[i].exefile, j);
return;
}
_exit(1);
}
/* Child process. Exec exe file. */
if (execv(args.we_wordv[0], args.we_wordv) < 0)
{
fprintf(stderr,"Cannot exec %s: %s\n",
children[i].exefile,
strerror(errno));
exit(1);
_exit(1);
}
/* Free the wordexp'd args */
wordfree(&args);
Expand Down
2 changes: 1 addition & 1 deletion src/mapped_exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ execute_cmd(exec_cmd_t *cmd)
}

/* Do the shell expansion */
if(wordexp_err = wordexp(command, &args, 0))
if(wordexp_err = wordexp(command, &args, WRDE_NOCMD))
{
fprintf(stderr,"wordexp: unable to parse the command line \"%s\" (error %d)\n", command, wordexp_err);
return(1);
Expand Down
2 changes: 1 addition & 1 deletion src/mtsafe_popen.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ exe_getouterr(char *const command, char *const environment[], char **cmd_output,
envcopy[envcopy_size + i] = (char *)NULL;

/* Do the shell expansion */
if(i = wordexp(command, &args, 0))
if(i = wordexp(command, &args, WRDE_NOCMD))
{
fprintf(stderr,"wordexp: unable to parse the command line \"%s\" (error %d)\n", command, i);
return(1);
Expand Down

0 comments on commit 1a8f6f5

Please sign in to comment.