From: Derrick Brashear Date: Mon, 31 Jul 2006 19:15:34 +0000 (+0000) Subject: STABLE14-va-copy-instead-of-just-pointering-20060731 X-Git-Tag: openafs-stable-1_4_2b3~16 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=27f21f7e8d40f80b8866efd00e7daf70d939aed9;p=packages%2Fo%2Fopenafs.git STABLE14-va-copy-instead-of-just-pointering-20060731 FIXES 35559 va_list isn't integral on ppc (cherry picked from commit da4775909094e8dc1e14fa9cdbf8ba3baaebf23a) --- diff --git a/src/audit/audit.c b/src/audit/audit.c index bc3dca5b2..e54ddf808 100644 --- a/src/audit/audit.c +++ b/src/audit/audit.c @@ -37,6 +37,16 @@ RCSID #endif #include +/* C99 requires va_copy. Older versions of GCC provide __va_copy. Per t + Autoconf manual, memcpy is a generally portable fallback. */ +#ifndef va_copy +# ifdef __va_copy +# define va_copy(d, s) __va_copy((d), (s)) +# else +# define va_copy(d, s) memcpy(&(d), &(s), sizeof(va_list)) +# endif +#endif + char *bufferPtr; int bufferLen; int osi_audit_all = (-1); /* Not determined yet */ @@ -88,8 +98,9 @@ audmakebuf(char *audEvent, va_list vaList) bufferPtr += sizeof(vaLong); break; case AUD_LST: /* Ptr to another list */ - vaLst = va_arg(vaList, va_list); + va_copy(vaLst, vaList); audmakebuf(audEvent, vaLst); + va_end(vaLst); break; case AUD_FID: /* AFSFid - contains 3 entries */ vaFid = (struct AFSFid *)va_arg(vaList, struct AFSFid *); @@ -213,8 +224,9 @@ printbuf(FILE *out, int rec, char *audEvent, afs_int32 errCode, va_list vaList) fprintf(out, "LONG %d ", vaLong); break; case AUD_LST: /* Ptr to another list */ - vaLst = va_arg(vaList, va_list); + va_copy(vaLst, vaList); printbuf(out, 1, "VALST", 0, vaLst); + va_end(vaLst); break; case AUD_FID: /* AFSFid - contains 3 entries */ vaFid = va_arg(vaList, struct AFSFid *);