Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/telnetd try netflush() if buffer is too low.
details: https://anonhg.NetBSD.org/src/rev/86cba1156b4f
branches: trunk
changeset: 512914:86cba1156b4f
user: itojun <itojun%NetBSD.org@localhost>
date: Thu Jul 19 07:26:53 2001 +0000
description:
try netflush() if buffer is too low.
diffstat:
libexec/telnetd/state.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diffs (41 lines):
diff -r 3531e25cf21d -r 86cba1156b4f libexec/telnetd/state.c
--- a/libexec/telnetd/state.c Thu Jul 19 06:40:01 2001 +0000
+++ b/libexec/telnetd/state.c Thu Jul 19 07:26:53 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: state.c,v 1.15 2001/07/19 04:57:50 itojun Exp $ */
+/* $NetBSD: state.c,v 1.16 2001/07/19 07:26:53 itojun Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)state.c 8.5 (Berkeley) 5/30/95";
#else
-__RCSID("$NetBSD: state.c,v 1.15 2001/07/19 04:57:50 itojun Exp $");
+__RCSID("$NetBSD: state.c,v 1.16 2001/07/19 07:26:53 itojun Exp $");
#endif
#endif /* not lint */
@@ -1691,6 +1691,11 @@
va_start(args, format);
remaining = BUFSIZ - (nfrontp - netobuf);
+ /* try a netflush() if the room is too low */
+ if (strlen(format) > remaining || BUFSIZ / 4 > remaining) {
+ netflush();
+ remaining = BUFSIZ - (nfrontp - netobuf);
+ }
ret = vsnprintf(nfrontp, remaining, format, args);
nfrontp += ret;
va_end(args);
@@ -1703,6 +1708,10 @@
size_t remaining;
remaining = BUFSIZ - (nfrontp - netobuf);
+ if (remaining < l) {
+ netflush();
+ remaining = BUFSIZ - (nfrontp - netobuf);
+ }
if (remaining < l)
return -1;
memmove(nfrontp, buf, l);
Home |
Main Index |
Thread Index |
Old Index