summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2005-09-16 04:00:51 +0000
committerDamien Miller <djm@cvs.openbsd.org>2005-09-16 04:00:51 +0000
commit15c3645b847465b2a4b2afbda4ce4636040d7d9b (patch)
treec2b7611e07c8bb31169146a92eaf2352dbe7faa2
parent8a25a7950ff63825e845350907f8493fcca07e5d (diff)
reorder tests for improved sanity, from stevesk@
-rw-r--r--usr.sbin/syslogd/ringbuf.c7
1 files changed, 5 insertions, 2 deletions
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);
/*