summaryrefslogtreecommitdiffstats
path: root/openbsd-compat
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2016-07-15 06:48:30 +0200
committerDarren Tucker <dtucker@zip.com.au>2016-07-15 06:54:16 +0200
commit5abfb15ced985c340359ae7fb65a625ed3692b3e (patch)
treebcde17550f213403000237c99a541ec43cae38b1 /openbsd-compat
parentdisable ciphers not supported by OpenSSL (diff)
downloadopenssh-5abfb15ced985c340359ae7fb65a625ed3692b3e.tar.xz
openssh-5abfb15ced985c340359ae7fb65a625ed3692b3e.zip
Move VA_COPY macro into compat header.
Some AIX compilers unconditionally undefine va_copy but don't set it back to an internal function, causing link errors. In some compat code we already use VA_COPY instead so move the two existing instances into the shared header and use for sshbuf-getput-basic.c too. Should fix building with at lease some versions of AIX's compiler. bz#2589, ok djm@
Diffstat (limited to 'openbsd-compat')
-rw-r--r--openbsd-compat/bsd-asprintf.c12
-rw-r--r--openbsd-compat/bsd-snprintf.c12
-rw-r--r--openbsd-compat/openbsd-compat.h17
3 files changed, 17 insertions, 24 deletions
diff --git a/openbsd-compat/bsd-asprintf.c b/openbsd-compat/bsd-asprintf.c
index 3368195d4..7b83448ca 100644
--- a/openbsd-compat/bsd-asprintf.c
+++ b/openbsd-compat/bsd-asprintf.c
@@ -25,18 +25,6 @@
#include <stdarg.h>
#include <stdlib.h>
-#ifndef VA_COPY
-# ifdef HAVE_VA_COPY
-# define VA_COPY(dest, src) va_copy(dest, src)
-# else
-# ifdef HAVE___VA_COPY
-# define VA_COPY(dest, src) __va_copy(dest, src)
-# else
-# define VA_COPY(dest, src) (dest) = (src)
-# endif
-# endif
-#endif
-
#define INIT_SZ 128
int
diff --git a/openbsd-compat/bsd-snprintf.c b/openbsd-compat/bsd-snprintf.c
index 23a635989..d95b6a401 100644
--- a/openbsd-compat/bsd-snprintf.c
+++ b/openbsd-compat/bsd-snprintf.c
@@ -99,18 +99,6 @@
# undef HAVE_VSNPRINTF
#endif
-#ifndef VA_COPY
-# ifdef HAVE_VA_COPY
-# define VA_COPY(dest, src) va_copy(dest, src)
-# else
-# ifdef HAVE___VA_COPY
-# define VA_COPY(dest, src) __va_copy(dest, src)
-# else
-# define VA_COPY(dest, src) (dest) = (src)
-# endif
-# endif
-#endif
-
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
#include <ctype.h>
diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h
index 997541e43..37d2064cd 100644
--- a/openbsd-compat/openbsd-compat.h
+++ b/openbsd-compat/openbsd-compat.h
@@ -253,6 +253,23 @@ int mbtowc(wchar_t *, const char*, size_t);
# include <stdarg.h>
#endif
+/*
+ * Some platforms unconditionally undefine va_copy() so we define VA_COPY()
+ * instead. This is known to be the case on at least some configurations of
+ * AIX with the xlc compiler.
+ */
+#ifndef VA_COPY
+# ifdef HAVE_VA_COPY
+# define VA_COPY(dest, src) va_copy(dest, src)
+# else
+# ifdef HAVE___VA_COPY
+# define VA_COPY(dest, src) __va_copy(dest, src)
+# else
+# define VA_COPY(dest, src) (dest) = (src)
+# endif
+# endif
+#endif
+
#ifndef HAVE_VASPRINTF
int vasprintf(char **, const char *, va_list);
#endif