diff options
| author | Douglas B. Rumbaugh <doug@douglasrumbaugh.com> | 2025-11-01 14:53:14 -0400 |
|---|---|---|
| committer | Douglas B. Rumbaugh <doug@douglasrumbaugh.com> | 2025-11-01 14:53:14 -0400 |
| commit | ddcf611815c145b1fadca042e65648a7a81cc497 (patch) | |
| tree | 9e11e5a372f2df528d162d17050eada50ad1db56 /src/command.c | |
| parent | 406889ed5c780f0e28703b143c72bbf035280b25 (diff) | |
| download | hush-ddcf611815c145b1fadca042e65648a7a81cc497.tar.gz | |
Added variable support
Diffstat (limited to 'src/command.c')
| -rw-r--r-- | src/command.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/command.c b/src/command.c index 20b00b1..3d63121 100644 --- a/src/command.c +++ b/src/command.c @@ -119,7 +119,15 @@ pid_t execute_command(command *cmd) { close(cmd->pipe[1]); } - execvp(cmd->command, cmd->args); + /* + * NOTE: discarding the const qualifier here is okay because either + * 1) exec fails, in which case the process is aborted immediately + * 2) exec succeeds, in which case the memory is released immediately + * + * In either case, the args won't be accessed again. + */ + execvp(cmd->command, (char**)cmd->args); + perror("Could not run command"); exit(EXIT_FAILURE); } else if (res < 0) { |