From c1b687c9e40f3492102395ad78da06e246204fd7 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 24 Aug 2009 22:44:22 +0200 Subject: [PATCH] simplify code by removing code duplication --- src/channel.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/channel.c b/src/channel.c index 8e30782..e52b03b 100644 --- a/src/channel.c +++ b/src/channel.c @@ -399,18 +399,12 @@ channel_direct_tcpip(LIBSSH2_SESSION * session, const char *host, /* by default we set (keep?) idle state... */ session->direct_state = libssh2_NB_state_idle; - if (!channel) { - if (libssh2_session_last_errno(session) == LIBSSH2_ERROR_EAGAIN) { - /* The error code is still set to LIBSSH2_ERROR_EAGAIN, - set our state to created to avoid re-creating the package - on next invoke */ - session->direct_state = libssh2_NB_state_created; - return NULL; - } else { - LIBSSH2_FREE(session, session->direct_message); - session->direct_message = NULL; - return NULL; - } + if (!channel && + libssh2_session_last_errno(session) == LIBSSH2_ERROR_EAGAIN) { + /* The error code is still set to LIBSSH2_ERROR_EAGAIN, set our state + to created to avoid re-creating the package on next invoke */ + session->direct_state = libssh2_NB_state_created; + return NULL; } LIBSSH2_FREE(session, session->direct_message);