diff --git a/libssh/channels.c b/libssh/channels.c index c006d248..ac49b381 100644 --- a/libssh/channels.c +++ b/libssh/channels.c @@ -1793,7 +1793,9 @@ int channel_get_exit_status(ssh_channel channel) { return -1; } if (channel->open == 0) { - return -1; + /* When a channel is closed, no exit status message can + * come anymore */ + break; } }