Define INVALID_SOCKET and use it instead of SOCKET_BAD.
Revert the part of previous commit that defines SOCKET_BAD library wide.
Этот коммит содержится в:
родитель
8436e45ea6
Коммит
d00e97a7f1
10
src/agent.c
10
src/agent.c
@ -124,6 +124,10 @@ struct agent_ops {
|
|||||||
agent_disconnect_func disconnect;
|
agent_disconnect_func disconnect;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef INVALID_SOCKET
|
||||||
|
#define INVALID_SOCKET -1
|
||||||
|
#endif
|
||||||
|
|
||||||
struct _LIBSSH2_AGENT
|
struct _LIBSSH2_AGENT
|
||||||
{
|
{
|
||||||
LIBSSH2_SESSION *session; /* the session this "belongs to" */
|
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
|
static int
|
||||||
agent_disconnect_pageant(LIBSSH2_AGENT *agent)
|
agent_disconnect_pageant(LIBSSH2_AGENT *agent)
|
||||||
{
|
{
|
||||||
agent->fd = SOCKET_BAD;
|
agent->fd = INVALID_SOCKET;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -737,7 +741,7 @@ libssh2_agent_userauth(LIBSSH2_AGENT *agent,
|
|||||||
LIBSSH2_API int
|
LIBSSH2_API int
|
||||||
libssh2_agent_disconnect(LIBSSH2_AGENT *agent)
|
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 agent->ops->disconnect(agent);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -751,7 +755,7 @@ libssh2_agent_disconnect(LIBSSH2_AGENT *agent)
|
|||||||
LIBSSH2_API void
|
LIBSSH2_API void
|
||||||
libssh2_agent_free(LIBSSH2_AGENT *agent) {
|
libssh2_agent_free(LIBSSH2_AGENT *agent) {
|
||||||
/* Allow connection freeing when the socket has lost its connection */
|
/* Allow connection freeing when the socket has lost its connection */
|
||||||
if (agent->fd != SOCKET_BAD) {
|
if (agent->fd != INVALID_SOCKET) {
|
||||||
libssh2_agent_disconnect(agent);
|
libssh2_agent_disconnect(agent);
|
||||||
}
|
}
|
||||||
agent_free_identities(agent);
|
agent_free_identities(agent);
|
||||||
|
@ -151,10 +151,8 @@ static inline int writev(int sock, struct iovec *iov, int nvecs)
|
|||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
typedef SOCKET libssh2_socket_t;
|
typedef SOCKET libssh2_socket_t;
|
||||||
#define SOCKET_BAD ~0
|
|
||||||
#else /* !WIN32 */
|
#else /* !WIN32 */
|
||||||
typedef int libssh2_socket_t;
|
typedef int libssh2_socket_t;
|
||||||
#define SOCKET_BAD -1
|
|
||||||
#endif /* WIN32 */
|
#endif /* WIN32 */
|
||||||
|
|
||||||
/* RFC4253 section 6.1 Maximum Packet Length says:
|
/* RFC4253 section 6.1 Maximum Packet Length says:
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user