From: Rusty Russell Date: Thu, 28 Feb 2019 05:26:10 +0000 (+1030) Subject: ccan: fix erroneous fd negation in poll.c. X-Git-Url: http://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=0fa318d0eeccbb4d33310f048653fa212c12d86d 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: Rusty Russell --- diff --git a/ccan/io/poll.c b/ccan/io/poll.c index a853c870..b44f1256 100644 --- a/ccan/io/poll.c +++ b/ccan/io/poll.c @@ -58,7 +58,7 @@ static bool add_fd(struct fd *fd, short events) pollfds[num_fds].events = events; /* In case it's idle. */ if (!events) - pollfds[num_fds].fd = -fd->fd; + pollfds[num_fds].fd = -fd->fd - 1; else pollfds[num_fds].fd = fd->fd; pollfds[num_fds].revents = 0; /* In case we're iterating now */ @@ -176,7 +176,7 @@ void backend_new_plan(struct io_conn *conn) num_waiting++; pfd->fd = conn->fd.fd; } else { - pfd->fd = -conn->fd.fd; + pfd->fd = -conn->fd.fd - 1; } }