From 15c3645b847465b2a4b2afbda4ce4636040d7d9b Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 16 Sep 2005 04:00:51 +0000 Subject: reorder tests for improved sanity, from stevesk@ --- usr.sbin/syslogd/ringbuf.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'usr.sbin/syslogd') diff --git a/usr.sbin/syslogd/ringbuf.c b/usr.sbin/syslogd/ringbuf.c index 5082970e292..80c91e7df56 100644 --- a/usr.sbin/syslogd/ringbuf.c +++ b/usr.sbin/syslogd/ringbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ringbuf.c,v 1.5 2005/09/16 03:59:12 djm Exp $ */ +/* $OpenBSD: ringbuf.c,v 1.6 2005/09/16 04:00:50 djm Exp $ */ /* * Copyright (c) 2004 Damien Miller @@ -84,10 +84,13 @@ ringbuf_append_line(struct ringbuf *rb, char *line) return (-1); llen = strlen(line); + if (llen == 0) + return (-1); + if (line[llen - 1] != '\n') llen++; /* one extra for appended '\n' */ - if (rb == NULL || llen == 0 || llen >= rb->len) + if (llen >= rb->len) return (-1); /* -- cgit v1.2.3