1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-11-20 02:42:09 +03:00

Define INVALID_SOCKET and use it instead of SOCKET_BAD.

Revert the part of previous commit that defines SOCKET_BAD library wide.
This commit is contained in:
Daiki Ueno
2009-12-25 10:04:34 +09:00
parent 8436e45ea6
commit d00e97a7f1
2 changed files with 7 additions and 5 deletions

View File

@@ -124,6 +124,10 @@ struct agent_ops {
agent_disconnect_func disconnect;
};
#ifndef INVALID_SOCKET
#define INVALID_SOCKET -1
#endif
struct _LIBSSH2_AGENT
{
LIBSSH2_SESSION *session; /* the session this "belongs to" */
@@ -316,7 +320,7 @@ agent_transact_pageant(LIBSSH2_AGENT *agent, agent_transaction_ctx_t transctx)
static int
agent_disconnect_pageant(LIBSSH2_AGENT *agent)
{
agent->fd = SOCKET_BAD;
agent->fd = INVALID_SOCKET;
return 0;
}
@@ -737,7 +741,7 @@ libssh2_agent_userauth(LIBSSH2_AGENT *agent,
LIBSSH2_API int
libssh2_agent_disconnect(LIBSSH2_AGENT *agent)
{
if (agent->ops && agent->fd != SOCKET_BAD)
if (agent->ops && agent->fd != INVALID_SOCKET)
return agent->ops->disconnect(agent);
return 0;
}
@@ -751,7 +755,7 @@ libssh2_agent_disconnect(LIBSSH2_AGENT *agent)
LIBSSH2_API void
libssh2_agent_free(LIBSSH2_AGENT *agent) {
/* Allow connection freeing when the socket has lost its connection */
if (agent->fd != SOCKET_BAD) {
if (agent->fd != INVALID_SOCKET) {
libssh2_agent_disconnect(agent);
}
agent_free_identities(agent);