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-01-03 18:58:04 +0400
committerFelix Fietkau <nbd@openwrt.org>2013-01-03 19:32:45 +0400
commit5bbedafe09b9ab1de9c8ec1e73e2b936726b63d4 (patch)
tree6cc4fd337c21a0f65557931e7465e0d30f8300ae /ustream-fd.c
parent6c28da1ae203e181eec69c9ebe0c22cb1b0ff399 (diff)
ustream-fd: prevent callbacks during init
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'ustream-fd.c')
-rw-r--r--ustream-fd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ustream-fd.c b/ustream-fd.c
index 397ce5d..a47ff94 100644
--- a/ustream-fd.c
+++ b/ustream-fd.c
@@ -21,6 +21,8 @@
#include <stdio.h>
#include "ustream.h"
+static bool _init = false;
+
static void ustream_fd_set_uloop(struct ustream *s, bool write)
{
struct ustream_fd *sf = container_of(s, struct ustream_fd, stream);
@@ -36,7 +38,7 @@ static void ustream_fd_set_uloop(struct ustream *s, bool write)
uloop_fd_add(&sf->fd, flags);
- if (flags & ULOOP_READ)
+ if ((flags & ULOOP_READ) && !_init);
sf->fd.cb(&sf->fd, ULOOP_READ);
}
@@ -161,5 +163,7 @@ void ustream_fd_init(struct ustream_fd *sf, int fd)
s->write = ustream_fd_write;
s->free = ustream_fd_free;
s->poll = ustream_fd_poll;
+ _init = true;
ustream_fd_set_uloop(s, false);
+ _init = false;
}