Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/crypto/external/bsd/openssh/dist Reapply formatting cleanup
details: https://anonhg.NetBSD.org/src/rev/44bd11f92528
branches: trunk
changeset: 769621:44bd11f92528
user: joerg <joerg%NetBSD.org@localhost>
date: Fri Sep 16 15:36:00 2011 +0000
description:
Reapply formatting cleanup
diffstat:
crypto/external/bsd/openssh/dist/log.c | 31 +++++++++++++++++++++----------
1 files changed, 21 insertions(+), 10 deletions(-)
diffs (69 lines):
diff -r 8a7a66f3e838 -r 44bd11f92528 crypto/external/bsd/openssh/dist/log.c
--- a/crypto/external/bsd/openssh/dist/log.c Fri Sep 16 14:32:53 2011 +0000
+++ b/crypto/external/bsd/openssh/dist/log.c Fri Sep 16 15:36:00 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: log.c,v 1.5 2011/09/07 17:49:19 christos Exp $ */
+/* $NetBSD: log.c,v 1.6 2011/09/16 15:36:00 joerg Exp $ */
/* $OpenBSD: log.c,v 1.42 2011/06/17 21:44:30 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo%cs.hut.fi@localhost>
@@ -36,7 +36,7 @@
*/
#include "includes.h"
-__RCSID("$NetBSD: log.c,v 1.5 2011/09/07 17:49:19 christos Exp $");
+__RCSID("$NetBSD: log.c,v 1.6 2011/09/16 15:36:00 joerg Exp $");
#include <sys/types.h>
#include <sys/uio.h>
@@ -325,8 +325,10 @@
#ifdef SYSLOG_DATA_INIT
struct syslog_data sdata = SYSLOG_DATA_INIT;
#endif
- char msgbuf[MSGBUFSIZ];
+ char msgbuf[MSGBUFSIZ], *msgbufp;
char visbuf[MSGBUFSIZ * 4 + 1];
+ size_t len, len2;
+ int len3;
const char *txt = NULL;
int pri = LOG_INFO;
int saved_errno = errno;
@@ -369,13 +371,19 @@
pri = LOG_ERR;
break;
}
+ len = sizeof(msgbuf);
+ msgbufp = msgbuf;
if (txt != NULL && log_handler == NULL) {
- snprintf(visbuf, sizeof(visbuf), "%s: %s", txt, fmt);
- vsnprintf(msgbuf, sizeof(msgbuf), visbuf, args);
- } else {
- vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);
+ len2 = strlen(txt);
+ if (len2 >= len)
+ len2 = len - 1;
+ memcpy(msgbufp, txt, len2);
+ msgbufp += len2;
+ *msgbufp++ = '\0';
+ len -= len2 + 1;
}
- strnvis(visbuf, sizeof(visbuf), msgbuf, VIS_SAFE|VIS_OCTAL);
+ vsnprintf(msgbufp, len, fmt, args);
+ len3 = strnvis(visbuf, sizeof(visbuf), msgbuf, VIS_SAFE|VIS_OCTAL);
if (log_handler != NULL) {
/* Avoid recursion */
tmp_handler = log_handler;
@@ -383,8 +391,11 @@
tmp_handler(level, visbuf, log_handler_ctx);
log_handler = tmp_handler;
} else if (log_on_stderr) {
- snprintf(msgbuf, sizeof msgbuf, "%s\r\n", visbuf);
- write(STDERR_FILENO, msgbuf, strlen(msgbuf));
+ struct iovec iov[] = {
+ { visbuf, len3 },
+ { __UNCONST("\r\n"), 2 },
+ };
+ writev(STDERR_FILENO, iov, __arraycount(iov));
} else {
#ifdef SYSLOG_DATA_INIT
openlog_r(argv0 ? argv0 : __progname, LOG_PID, log_facility, &sdata);
Home |
Main Index |
Thread Index |
Old Index