ossp-pkg/l2/l2_stream.c 1.11 -> 1.12
--- l2_stream.c 2001/09/05 07:38:04 1.11
+++ l2_stream.c 2001/09/05 13:33:55 1.12
@@ -168,12 +168,22 @@
/* format message */
vfmt.curpos = st->message;
- vfmt.endpos = st->message+ L2_MAX_MSGSIZE;
+ vfmt.endpos = st->message + L2_MAX_MSGSIZE;
vfmt.data[0].vp = st;
vfmt.flush = l2_stream_vlog_flush;
vfmt.format = l2_stream_vlog_format;
if ((len = l2_util_format(&vfmt, fmt, ap)) == -1)
return L2_ERROR;
+ if (len == 0)
+ return L2_ERROR;
+
+ /* make sure a trailing newline exists */
+ if (st->message[len-1] != '\n') {
+ if (len == L2_MAX_MSGSIZE)
+ return L2_ERROR;
+ st->message[len++] = '\n';
+ st->message[len] = '\0';
+ }
rv = L2_OK;
for (i = 0; i < L2_MAX_CHANNELS && st->channels[i].ch != NULL; i++) {
|
|