]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE14-va-copy-instead-of-just-pointering-20060731
authorDerrick Brashear <shadow@dementia.org>
Mon, 31 Jul 2006 19:15:34 +0000 (19:15 +0000)
committerDerrick Brashear <shadow@dementia.org>
Mon, 31 Jul 2006 19:15:34 +0000 (19:15 +0000)
FIXES 35559

va_list isn't integral on ppc

(cherry picked from commit da4775909094e8dc1e14fa9cdbf8ba3baaebf23a)

src/audit/audit.c

index bc3dca5b25696338978794f2a10091bd7855b7ea..e54ddf8089bf3ea189df716a318d931f2e64d93b 100644 (file)
@@ -37,6 +37,16 @@ RCSID
 #endif
 #include <afs/afsutil.h>
 
+/* 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 *);