Ticket #58 (closed defect)

Opened 9 years ago

Last modified 8 years ago

libssh2_poll doesn't work on win32

Reported by: apjenkins Owned by:
Priority: normal Milestone:
Component: Version:
Keywords: Cc: apjenkins, bagder
Blocked By: Blocks:

Description

[Sorry, this is a duplicate of bug 1862722, which I submitted anonymously by mistake]

Using libssh2 0.18, I found that libssh2_poll doesn't work on win32. It would always return 1, and the revents field of the LIBSSH2_POLLFD object I passed in would be set to garbage.

I found that the reason for this was that on WIN32, neither HAVE_SELECT nor HAVE_POLL get defined. The way libssh2_poll is written assumes that either the "ifdef HAVE_POLL" or "ifdef HAVE_SELECT" block of code will get
exected. If neither executes then no packets ever actually get read, it it just returns garbage.

Since Win32 does provide select, I simply defined HAVE_SELECT in win32/libssh2_config.h, and also made a small change to libssh2_priv.h so it won't try to include unix-only header files on windows. This made libssh2_poll work correctly on Windows. I've tested this patch with VStudio 2003 on a win32 machine, and VStudio 2005 on a win64 machine.

Attachments

libssh2-all-select.patch (940 bytes) - added by apjenkins 9 years ago.
Patch to enable HAVE_SELECT on win32 builds

Download all attachments as: .zip

Change History

Changed 9 years ago by apjenkins

Patch to enable HAVE_SELECT on win32 builds

comment:1 Changed 8 years ago by bagder

Thanks, committed!

Note: See TracTickets for help on using tickets.