From 84822fd6d529abc35bf8023403d547f8001bf5f3 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 30 Dec 2012 15:46:18 +0100 Subject: [PATCH] ustream: suppress write attempts in ustream_printf and ustream_vprintf if a write error was flagged Signed-off-by: Felix Fietkau --- ustream.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ustream.c b/ustream.c index 8e6efcd..9c14678 100644 --- a/ustream.c +++ b/ustream.c @@ -435,6 +435,9 @@ int ustream_vprintf(struct ustream *s, const char *format, va_list arg) va_list arg2; int wr, maxlen, buflen; + if (s->write_error) + return 0; + if (!l->data_bytes) { buf = alloca(MAX_STACK_BUFLEN); va_copy(arg2, arg); @@ -493,6 +496,9 @@ int ustream_printf(struct ustream *s, const char *format, ...) va_list arg; int ret; + if (s->write_error) + return 0; + va_start(arg, format); ret = ustream_vprintf(s, format, arg); va_end(arg); -- 2.25.1