From ddcf611815c145b1fadca042e65648a7a81cc497 Mon Sep 17 00:00:00 2001 From: "Douglas B. Rumbaugh" Date: Sat, 1 Nov 2025 14:53:14 -0400 Subject: Added variable support --- src/command.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/command.c') 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) { -- cgit v1.2.3