1
1

convert return -1 instances to return [proper error code]

Этот коммит содержится в:
Daniel Stenberg 2009-08-24 22:50:46 +02:00
родитель c1b687c9e4
Коммит dcb9625473
2 изменённых файлов: 9 добавлений и 9 удалений

Просмотреть файл

@ -633,7 +633,7 @@ static int channel_forward_cancel(LIBSSH2_LISTENER *listener)
if (!packet) { if (!packet) {
libssh2_error(session, LIBSSH2_ERROR_ALLOC, libssh2_error(session, LIBSSH2_ERROR_ALLOC,
"Unable to allocate memeory for setenv packet", 0); "Unable to allocate memeory for setenv packet", 0);
return -1; return LIBSSH2_ERROR_ALLOC;
} }
*(s++) = SSH_MSG_GLOBAL_REQUEST; *(s++) = SSH_MSG_GLOBAL_REQUEST;
@ -668,7 +668,7 @@ static int channel_forward_cancel(LIBSSH2_LISTENER *listener)
0); 0);
LIBSSH2_FREE(session, packet); LIBSSH2_FREE(session, packet);
listener->chanFwdCncl_state = libssh2_NB_state_idle; listener->chanFwdCncl_state = libssh2_NB_state_idle;
return -1; return LIBSSH2_ERROR_SOCKET_SEND;
} }
LIBSSH2_FREE(session, packet); LIBSSH2_FREE(session, packet);
@ -801,7 +801,7 @@ static int channel_setenv(LIBSSH2_CHANNEL *channel,
if (!channel->setenv_packet) { if (!channel->setenv_packet) {
libssh2_error(session, LIBSSH2_ERROR_ALLOC, libssh2_error(session, LIBSSH2_ERROR_ALLOC,
"Unable to allocate memeory for setenv packet", 0); "Unable to allocate memeory for setenv packet", 0);
return -1; return LIBSSH2_ERROR_ALLOC;
} }
*(s++) = SSH_MSG_CHANNEL_REQUEST; *(s++) = SSH_MSG_CHANNEL_REQUEST;
@ -840,7 +840,7 @@ static int channel_setenv(LIBSSH2_CHANNEL *channel,
LIBSSH2_FREE(session, channel->setenv_packet); LIBSSH2_FREE(session, channel->setenv_packet);
channel->setenv_packet = NULL; channel->setenv_packet = NULL;
channel->setenv_state = libssh2_NB_state_idle; channel->setenv_state = libssh2_NB_state_idle;
return -1; return LIBSSH2_ERROR_SOCKET_SEND;
} }
LIBSSH2_FREE(session, channel->setenv_packet); LIBSSH2_FREE(session, channel->setenv_packet);
channel->setenv_packet = NULL; channel->setenv_packet = NULL;
@ -860,7 +860,7 @@ static int channel_setenv(LIBSSH2_CHANNEL *channel,
} }
if (rc) { if (rc) {
channel->setenv_state = libssh2_NB_state_idle; channel->setenv_state = libssh2_NB_state_idle;
return -1; return rc;
} }
if (data[0] == SSH_MSG_CHANNEL_SUCCESS) { 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, libssh2_error(session, LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED,
"Unable to complete request for channel-setenv", 0); "Unable to complete request for channel-setenv", 0);
channel->setenv_state = libssh2_NB_state_idle; channel->setenv_state = libssh2_NB_state_idle;
return -1; return LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED;
} }
/* /*

Просмотреть файл

@ -1030,7 +1030,7 @@ _libssh2_packet_require(LIBSSH2_SESSION * session, unsigned char packet_type,
} }
/* Only reached if the socket died */ /* 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 */ /* 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 */ /* Only reached if the socket died */
state->start = 0; state->start = 0;
return -1; return LIBSSH2_ERROR_SOCKET_DISCONNECT;
} }