projects
/
project
/
libubox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
avl: fix type handling in container_of uses
[project/libubox.git]
/
uloop.c
diff --git
a/uloop.c
b/uloop.c
index
a3ba3ad
..
f0ccb0c
100644
(file)
--- a/
uloop.c
+++ b/
uloop.c
@@
-246,6
+246,9
@@
int uloop_fd_delete(struct uloop_fd *sock)
{
int i;
{
int i;
+ if (!sock->registered)
+ return 0;
+
for (i = cur_fd + 1; i < cur_nfds; i++) {
if (events[i].data.ptr != sock)
continue;
for (i = cur_fd + 1; i < cur_nfds; i++) {
if (events[i].data.ptr != sock)
continue;
@@
-302,6
+305,9
@@
int uloop_fd_add(struct uloop_fd *sock, unsigned int flags)
unsigned int fl;
int ret;
unsigned int fl;
int ret;
+ if (!(flags & (ULOOP_READ | ULOOP_WRITE)))
+ return uloop_fd_delete(sock);
+
if (!sock->registered && !(flags & ULOOP_BLOCKING)) {
fl = fcntl(sock->fd, F_GETFL, 0);
fl |= O_NONBLOCK;
if (!sock->registered && !(flags & ULOOP_BLOCKING)) {
fl = fcntl(sock->fd, F_GETFL, 0);
fl |= O_NONBLOCK;