Commit 0fa318d0 authored by Rusty Russell's avatar Rusty Russell

ccan: fix erroneous fd negation in poll.c.

We could just make them -1, since we don't rely on the values.
But simple negation doesn't make 0 invalid.
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent a5881c0d
...@@ -58,7 +58,7 @@ static bool add_fd(struct fd *fd, short events) ...@@ -58,7 +58,7 @@ static bool add_fd(struct fd *fd, short events)
pollfds[num_fds].events = events; pollfds[num_fds].events = events;
/* In case it's idle. */ /* In case it's idle. */
if (!events) if (!events)
pollfds[num_fds].fd = -fd->fd; pollfds[num_fds].fd = -fd->fd - 1;
else else
pollfds[num_fds].fd = fd->fd; pollfds[num_fds].fd = fd->fd;
pollfds[num_fds].revents = 0; /* In case we're iterating now */ pollfds[num_fds].revents = 0; /* In case we're iterating now */
...@@ -176,7 +176,7 @@ void backend_new_plan(struct io_conn *conn) ...@@ -176,7 +176,7 @@ void backend_new_plan(struct io_conn *conn)
num_waiting++; num_waiting++;
pfd->fd = conn->fd.fd; pfd->fd = conn->fd.fd;
} else { } else {
pfd->fd = -conn->fd.fd; pfd->fd = -conn->fd.fd - 1;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment