From: Trent Huber Date: Mon, 15 Jun 2026 02:11:25 +0000 (-0400) Subject: Bug fix for exec() X-Git-Url: http://trenthuber.com/code?a=commitdiff_plain;h=7ae423490d93fccee7692e71dec3a8916246f38b;p=thus.git Bug fix for exec() --- diff --git a/src/builtins/exec.c b/src/builtins/exec.c index f05b9f4..52831be 100644 --- a/src/builtins/exec.c +++ b/src/builtins/exec.c @@ -21,8 +21,8 @@ int exec(char **args, size_t numargs) { if (numargs < 2) return usage(args[0], "command [args ...]"); - clear(&c); - memcpy(c.tokens, args + 1, (c.numtokens = numargs - 1) * sizeof*args); + c = (struct context){.t = c.tokens, .numtokens = numargs - 1}; + memcpy(c.tokens, args + 1, c.numtokens * sizeof*args); strcpy(c.name, args[1]); if (!(c.builtin = getbuiltin(c.name)) && !(c.path = getpath(c.name))) return note("Unable to find `%s' command", c.name);