From 984e353160593b20d1e2944e1f2e9ce2117c8490 Mon Sep 17 00:00:00 2001 From: rsc Date: Sun, 22 Aug 2004 15:39:56 +0000 Subject: PowerPC Linux support from ericvh. Mainly adding va_copy/va_end. Also fix bug in sprint wrapping around top of memory. --- src/lib9/fmt/vsnprint.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/lib9/fmt/vsnprint.c') diff --git a/src/lib9/fmt/vsnprint.c b/src/lib9/fmt/vsnprint.c index 21662e6d..ad64203a 100644 --- a/src/lib9/fmt/vsnprint.c +++ b/src/lib9/fmt/vsnprint.c @@ -20,6 +20,7 @@ int vsnprint(char *buf, int len, char *fmt, va_list args) { Fmt f; + int x = 0; if(len <= 0) return -1; @@ -30,8 +31,9 @@ vsnprint(char *buf, int len, char *fmt, va_list args) f.flush = 0; f.farg = nil; f.nfmt = 0; - f.args = args; + va_copy(f.args,args); dofmt(&f, fmt); + va_end(f.args); *(char*)f.to = '\0'; return (char*)f.to - buf; } -- cgit v1.2.3