Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/mpl/dhcp/dist/omapip Don't use static buffers to st...
details: https://anonhg.NetBSD.org/src/rev/c6e098a77bd7
branches: trunk
changeset: 1016230:c6e098a77bd7
user: christos <christos%NetBSD.org@localhost>
date: Thu Nov 12 22:11:03 2020 +0000
description:
Don't use static buffers to store format strings; this is a multi-threaded
program and if we print from multiple threads we can end up overwriting the
formats while printf is formating and that can end up in tears.
diffstat:
external/mpl/dhcp/dist/omapip/errwarn.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diffs (62 lines):
diff -r b9d3f941533f -r c6e098a77bd7 external/mpl/dhcp/dist/omapip/errwarn.c
--- a/external/mpl/dhcp/dist/omapip/errwarn.c Thu Nov 12 21:54:52 2020 +0000
+++ b/external/mpl/dhcp/dist/omapip/errwarn.c Thu Nov 12 22:11:03 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: errwarn.c,v 1.3 2020/08/03 21:10:57 christos Exp $ */
+/* $NetBSD: errwarn.c,v 1.4 2020/11/12 22:11:03 christos Exp $ */
/* errwarn.c
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: errwarn.c,v 1.3 2020/08/03 21:10:57 christos Exp $");
+__RCSID("$NetBSD: errwarn.c,v 1.4 2020/11/12 22:11:03 christos Exp $");
#include "dhcpd.h"
@@ -50,14 +50,14 @@
void (*log_cleanup) (void);
#define CVT_BUF_MAX 1023
-static char mbuf [CVT_BUF_MAX + 1];
-static char fbuf [CVT_BUF_MAX + 1];
/* Log an error message, then exit... */
void log_fatal (const char * fmt, ... )
{
va_list list;
+ char mbuf [CVT_BUF_MAX + 1];
+ char fbuf [CVT_BUF_MAX + 1];
do_percentm (fbuf, sizeof fbuf, fmt);
@@ -96,6 +96,8 @@
int log_error (const char * fmt, ...)
{
+ char mbuf [CVT_BUF_MAX + 1];
+ char fbuf [CVT_BUF_MAX + 1];
va_list list;
do_percentm (fbuf, sizeof fbuf, fmt);
@@ -123,6 +125,8 @@
int log_info (const char *fmt, ...)
{
+ char mbuf [CVT_BUF_MAX + 1];
+ char fbuf [CVT_BUF_MAX + 1];
va_list list;
do_percentm (fbuf, sizeof fbuf, fmt);
@@ -150,6 +154,8 @@
int log_debug (const char *fmt, ...)
{
+ char mbuf [CVT_BUF_MAX + 1];
+ char fbuf [CVT_BUF_MAX + 1];
va_list list;
do_percentm (fbuf, sizeof fbuf, fmt);
Home |
Main Index |
Thread Index |
Old Index