diff options
author | Felix Fietkau <nbd@openwrt.org> | 2013-06-21 21:53:09 +0400 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2013-06-21 21:53:09 +0400 |
commit | c434230a76e2fdd97b77ca96f64569c91e7df8a1 (patch) | |
tree | 670545a0a3b8b589f11856ad7724cff5141ed293 /ustream.c | |
parent | 6f192a6fb04504e065c222be11a6e294229300fe (diff) |
ustream: return NULL in ustream_get_read_buf if there's a buffer, but no data
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'ustream.c')
-rw-r--r-- | ustream.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -311,15 +311,13 @@ void ustream_fill_read(struct ustream *s, int len) char *ustream_get_read_buf(struct ustream *s, int *buflen) { - char *data; - int len; + char *data = NULL; + int len = 0; if (s->r.head) { len = s->r.head->tail - s->r.head->data; - data = s->r.head->data; - } else { - len = 0; - data = NULL; + if (len > 0) + data = s->r.head->data; } if (buflen) |