diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-05-05 08:27:30 +0000 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-05-05 08:27:30 +0000 |
commit | 65331f470a6f260999408a90e174eb718fe10e94 (patch) | |
tree | 6a801de698165d51271578d7c4d37a7068faeef0 /libssh | |
parent | d6e23b76283795eac13ed1cb6e408f54b6003790 (diff) | |
download | libssh-65331f470a6f260999408a90e174eb718fe10e94.tar.gz libssh-65331f470a6f260999408a90e174eb718fe10e94.tar.xz libssh-65331f470a6f260999408a90e174eb718fe10e94.zip |
Improve channel_request_pty_size1().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@731 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh')
-rw-r--r-- | libssh/channels1.c | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/libssh/channels1.c b/libssh/channels1.c index ac7d25a..d283c6d 100644 --- a/libssh/channels1.c +++ b/libssh/channels1.c @@ -85,40 +85,25 @@ int channel_request_pty_size1(CHANNEL *channel, const char *terminal, int col, return -1; } - if (buffer_add_u8(session->out_buffer, SSH_CMSG_REQUEST_PTY) < 0) { - string_free(str); - return -1; - } - if (buffer_add_ssh_string(session->out_buffer, str) < 0) { + if (buffer_add_u8(session->out_buffer, SSH_CMSG_REQUEST_PTY) < 0 || + buffer_add_ssh_string(session->out_buffer, str) < 0) { string_free(str); return -1; } string_free(str); - if (buffer_add_u32(session->out_buffer, ntohl(row)) < 0) { - return -1; - } - if (buffer_add_u32(session->out_buffer, ntohl(col)) < 0) { - return -1; - } - if (buffer_add_u32(session->out_buffer, 0) < 0) { /* x */ - return -1; - } - if (buffer_add_u32(session->out_buffer, 0) < 0) { /* y */ - return -1; - } - if (buffer_add_u8(session->out_buffer, 0) < 0) { /* tty things */ + if (buffer_add_u32(session->out_buffer, ntohl(row)) < 0 || + buffer_add_u32(session->out_buffer, ntohl(col)) < 0 || + buffer_add_u32(session->out_buffer, 0) < 0 || /* x */ + buffer_add_u32(session->out_buffer, 0) < 0 || /* y */ + buffer_add_u8(session->out_buffer, 0) < 0) { /* tty things */ return -1; } ssh_log(session, SSH_LOG_FUNCTIONS, "Opening a ssh1 pty"); - if (packet_send(session) != SSH_OK) { - return -1; - } - if (packet_read(session) != SSH_OK) { - return -1; - } - if (packet_translate(session) != SSH_OK) { + if (packet_send(session) != SSH_OK || + packet_read(session) != SSH_OK || + packet_translate(session) != SSH_OK) { return -1; } |