Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-06-21 21:53:09 +0400
committerFelix Fietkau <nbd@openwrt.org>2013-06-21 21:53:09 +0400
commitc434230a76e2fdd97b77ca96f64569c91e7df8a1 (patch)
tree670545a0a3b8b589f11856ad7724cff5141ed293 /ustream.c
parent6f192a6fb04504e065c222be11a6e294229300fe (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.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/ustream.c b/ustream.c
index 88f1332..fd43395 100644
--- a/ustream.c
+++ b/ustream.c
@@ -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)