summaryrefslogtreecommitdiff
path: root/missing/snprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'missing/snprintf.c')
-rw-r--r--missing/snprintf.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/missing/snprintf.c b/missing/snprintf.c
index 99f0bdfc2a93..672aeb86a6d6 100644
--- a/missing/snprintf.c
+++ b/missing/snprintf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995-1999 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995-1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -31,6 +31,10 @@
* SUCH DAMAGE.
*/
+/*
+ * We use this for platforms that don't have snprintf() at all.
+ */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -42,7 +46,7 @@
#include <ctype.h>
#include <sys/types.h>
-#include <pcap-int.h>
+#include "portability.h"
enum format_flags {
minus_flag = 1,
@@ -525,6 +529,7 @@ pcap_asnprintf (char **ret, size_t max_sz, const char *format, ...)
va_start(args, format);
val = pcap_vasnprintf (ret, max_sz, format, args);
+ va_end(args);
#ifdef PARANOIA
{
@@ -534,14 +539,15 @@ pcap_asnprintf (char **ret, size_t max_sz, const char *format, ...)
if (tmp == NULL)
abort ();
+ va_start(args, format);
ret2 = pcap_vsprintf (tmp, format, args);
+ va_end(args);
if (val != ret2 || strcmp(*ret, tmp))
abort ();
free (tmp);
}
#endif
- va_end(args);
return val;
}
#endif