summaryrefslogtreecommitdiff
path: root/usr.sbin/dhcpd
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2005-04-11 18:59:46 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2005-04-11 18:59:46 +0000
commit14772e2f4877aec1dba514bfcaad75cf1916d1bf (patch)
treea2075b34c3e24235a3f3d6f133baceba69677a35 /usr.sbin/dhcpd
parente2b09cb02ba6adfec18c2848e09762ba5ba6ba05 (diff)
use writev() here too; henning ok
Diffstat (limited to 'usr.sbin/dhcpd')
-rw-r--r--usr.sbin/dhcpd/errwarn.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/usr.sbin/dhcpd/errwarn.c b/usr.sbin/dhcpd/errwarn.c
index ef3ea2d20a4..36d4566b466 100644
--- a/usr.sbin/dhcpd/errwarn.c
+++ b/usr.sbin/dhcpd/errwarn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: errwarn.c,v 1.3 2005/04/11 18:50:37 fgsch Exp $ */
+/* $OpenBSD: errwarn.c,v 1.4 2005/04/11 18:59:45 deraadt Exp $ */
/* Errors and warnings... */
@@ -40,6 +40,9 @@
* with Vixie Laboratories.
*/
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <unistd.h>
#include <errno.h>
#include "dhcpd.h"
@@ -193,6 +196,7 @@ parse_warn(char *fmt, ...)
static char spaces[] =
" "
" "; /* 80 spaces */
+ struct iovec iov[6];
do_percentm(mbuf, sizeof(mbuf), fmt);
snprintf(fbuf, sizeof(fbuf), "%s line %d: %s", tlname, lexline, mbuf);
@@ -201,12 +205,19 @@ parse_warn(char *fmt, ...)
va_end(list);
if (log_perror) {
- write(2, mbuf, strlen(mbuf));
- write(2, "\n", 1);
- write(2, token_line, strlen(token_line));
- write(2, "\n", 1);
- write(2, spaces, lexchar - 1);
- write(2, "^\n", 2);
+ iov[0].iov_base = mbuf;
+ iov[0].iov_len = strlen(mbuf);
+ iov[1].iov_base = "\n";
+ iov[1].iov_len = 1;
+ iov[2].iov_base = token_line;
+ iov[2].iov_len = strlen(token_line);
+ iov[3].iov_base = "\n";
+ iov[3].iov_len = 1;
+ iov[4].iov_base = spaces;
+ iov[4].iov_len = lexchar - 1;
+ iov[5].iov_base = "^\n";
+ iov[5].iov_len = 2;
+ writev(2, iov, sizeof(iov)/sizeof(iov[0]));
} else {
syslog(log_priority | LOG_ERR, "%s", mbuf);
syslog(log_priority | LOG_ERR, "%s", token_line);