diff options
Diffstat (limited to 'lib/buffer.c')
| -rw-r--r-- | lib/buffer.c | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/lib/buffer.c b/lib/buffer.c index b573981c1b..1799c6b94f 100644 --- a/lib/buffer.c +++ b/lib/buffer.c @@ -25,6 +25,8 @@ #include "buffer.h" #include "log.h" #include "network.h" +#include "lib_errors.h" + #include <stddef.h> DEFINE_MTYPE_STATIC(LIB, BUFFER, "Buffer") @@ -272,19 +274,12 @@ buffer_status_t buffer_flush_window(struct buffer *b, int fd, int width, if (!b->head) return BUFFER_EMPTY; - if (height < 1) { - zlog_warn( - "%s called with non-positive window height %d, forcing to 1", - __func__, height); + if (height < 1) height = 1; - } else if (height >= 2) + else if (height >= 2) height--; - if (width < 1) { - zlog_warn( - "%s called with non-positive window width %d, forcing to 1", - __func__, width); + if (width < 1) width = 1; - } /* For erase and more data add two to b's buffer_data count.*/ if (b->head->next == NULL) { @@ -332,16 +327,12 @@ buffer_status_t buffer_flush_window(struct buffer *b, int fd, int width, { iov_alloc *= 2; if (iov != small_iov) { - zlog_warn( - "%s: growing iov array to %d; " - "width %d, height %d, size %lu", - __func__, iov_alloc, width, height, - (unsigned long)b->size); iov = XREALLOC(MTYPE_TMP, iov, iov_alloc * sizeof(*iov)); } else { /* This should absolutely never occur. */ - zlog_err( + flog_err_sys( + LIB_ERR_SYSTEM_CALL, "%s: corruption detected: iov_small overflowed; " "head %p, tail %p, head->next %p", __func__, (void *)b->head, @@ -456,9 +447,9 @@ in one shot. */ while (written > 0) { struct buffer_data *d; if (!(d = b->head)) { - zlog_err( - "%s: corruption detected: buffer queue empty, " - "but written is %lu", + flog_err( + LIB_ERR_DEVELOPMENT, + "%s: corruption detected: buffer queue empty, but written is %lu", __func__, (unsigned long)written); break; } |
