From dcb9625473ce6331fe6b0883ef9100170349daea Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 24 Aug 2009 22:50:46 +0200 Subject: [PATCH] convert return -1 instances to return [proper error code] --- src/channel.c | 12 ++++++------ src/packet.c | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/channel.c b/src/channel.c index e52b03b..fa6a968 100644 --- a/src/channel.c +++ b/src/channel.c @@ -633,7 +633,7 @@ static int channel_forward_cancel(LIBSSH2_LISTENER *listener) if (!packet) { libssh2_error(session, LIBSSH2_ERROR_ALLOC, "Unable to allocate memeory for setenv packet", 0); - return -1; + return LIBSSH2_ERROR_ALLOC; } *(s++) = SSH_MSG_GLOBAL_REQUEST; @@ -668,7 +668,7 @@ static int channel_forward_cancel(LIBSSH2_LISTENER *listener) 0); LIBSSH2_FREE(session, packet); listener->chanFwdCncl_state = libssh2_NB_state_idle; - return -1; + return LIBSSH2_ERROR_SOCKET_SEND; } LIBSSH2_FREE(session, packet); @@ -801,7 +801,7 @@ static int channel_setenv(LIBSSH2_CHANNEL *channel, if (!channel->setenv_packet) { libssh2_error(session, LIBSSH2_ERROR_ALLOC, "Unable to allocate memeory for setenv packet", 0); - return -1; + return LIBSSH2_ERROR_ALLOC; } *(s++) = SSH_MSG_CHANNEL_REQUEST; @@ -840,7 +840,7 @@ static int channel_setenv(LIBSSH2_CHANNEL *channel, LIBSSH2_FREE(session, channel->setenv_packet); channel->setenv_packet = NULL; channel->setenv_state = libssh2_NB_state_idle; - return -1; + return LIBSSH2_ERROR_SOCKET_SEND; } LIBSSH2_FREE(session, channel->setenv_packet); channel->setenv_packet = NULL; @@ -860,7 +860,7 @@ static int channel_setenv(LIBSSH2_CHANNEL *channel, } if (rc) { channel->setenv_state = libssh2_NB_state_idle; - return -1; + return rc; } if (data[0] == SSH_MSG_CHANNEL_SUCCESS) { @@ -875,7 +875,7 @@ static int channel_setenv(LIBSSH2_CHANNEL *channel, libssh2_error(session, LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED, "Unable to complete request for channel-setenv", 0); channel->setenv_state = libssh2_NB_state_idle; - return -1; + return LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED; } /* diff --git a/src/packet.c b/src/packet.c index b8181d6..6f80c96 100644 --- a/src/packet.c +++ b/src/packet.c @@ -1030,7 +1030,7 @@ _libssh2_packet_require(LIBSSH2_SESSION * session, unsigned char packet_type, } /* Only reached if the socket died */ - return -1; + return LIBSSH2_ERROR_SOCKET_DISCONNECT; } /* @@ -1090,7 +1090,7 @@ _libssh2_packet_burn(LIBSSH2_SESSION * session, } /* Only reached if the socket died */ - return -1; + return LIBSSH2_ERROR_SOCKET_DISCONNECT; } /* @@ -1150,6 +1150,6 @@ _libssh2_packet_requirev(LIBSSH2_SESSION * session, /* Only reached if the socket died */ state->start = 0; - return -1; + return LIBSSH2_ERROR_SOCKET_DISCONNECT; }