]> granicus.if.org Git - libevent/commitdiff
Revert "Fix potential fd leak in listener_read_cb()"
authorAzat Khuzhin <a3at.mail@gmail.com>
Tue, 5 Dec 2017 19:59:20 +0000 (22:59 +0300)
committerAzat Khuzhin <a3at.mail@gmail.com>
Sun, 10 Dec 2017 20:55:51 +0000 (23:55 +0300)
This reverts commit a695a720cda892c270736d127333d73553842094.

@kgraefe:
  "I believe that this commit is just wrong: if lev->cnt is not 1 after
  the callback, new_fd will still never be closed in listener_read_cb().
  So in that case it is the responsibility of the user's code to close
  the file descriptor (which is fine). But why shouldn't it be in the
  other case? And how does the user's code know?"

And I agree

listener.c

index 2862d32e38d0335c218e7ce8defc23a7911a8126..942fa45180f957fd4a6b751c21d8792cc5ce9d43 100644 (file)
@@ -421,8 +421,6 @@ listener_read_cb(evutil_socket_t fd, short what, void *p)
                if (lev->refcnt == 1) {
                        int freed = listener_decref_and_unlock(lev);
                        EVUTIL_ASSERT(freed);
-
-                       evutil_closesocket(new_fd);
                        return;
                }
                --lev->refcnt;