From 937a2180c157e5661ab1459229e9f270a7f5013d Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Tue, 30 Aug 2005 21:36:46 +0000 Subject: [PATCH] va_lists need not be assignable. Use va_copy() instead. --- lib/runcmd.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/runcmd.c b/lib/runcmd.c index c7fe85c4..dbb3c8a7 100644 --- a/lib/runcmd.c +++ b/lib/runcmd.c @@ -18,7 +18,8 @@ void NONRET exec_command_v(byte *cmd, va_list args) { - va_list cargs = args; + va_list cargs; + va_copy(cargs, args); int cnt = 2; byte *arg; while (arg = va_arg(cargs, byte *)) @@ -26,7 +27,7 @@ exec_command_v(byte *cmd, va_list args) char **argv = alloca(sizeof(byte *) * cnt); argv[0] = cmd; cnt = 1; - cargs = args; + va_copy(cargs, args); while (arg = va_arg(cargs, byte *)) argv[cnt++] = arg; argv[cnt] = NULL; @@ -72,7 +73,8 @@ echo_command_v(byte *buf, int size, byte *cmd, va_list args) byte *limit = buf + size - 4; byte *p = buf; byte *arg = cmd; - va_list cargs = args; + va_list cargs; + va_copy(cargs, args); do { int l = strlen(arg); -- 2.39.5