diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-05-04 06:57:15 +0000 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-05-04 06:57:15 +0000 |
commit | 0e6359c63d966ce37c9dd40a7cb3464c461d8aa5 (patch) | |
tree | d3372b84b3e1a4d0e39c619201a41a0748c4885d | |
parent | 3e1ed1707c2c60b6c44e2ece530b0cf8bb2b933d (diff) | |
download | libssh-0e6359c63d966ce37c9dd40a7cb3464c461d8aa5.tar.gz libssh-0e6359c63d966ce37c9dd40a7cb3464c461d8aa5.tar.xz libssh-0e6359c63d966ce37c9dd40a7cb3464c461d8aa5.zip |
Improve channel_change_pty_size().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@695 7dcaeef0-15fb-0310-b436-a5af3365683c
-rw-r--r-- | libssh/channels.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/libssh/channels.c b/libssh/channels.c index 19e7c08c..35717067 100644 --- a/libssh/channels.c +++ b/libssh/channels.c @@ -1131,13 +1131,18 @@ int channel_request_pty(CHANNEL *channel) { return channel_request_pty_size(channel, "xterm", 80, 24); } -/** \brief change the size of the terminal associated to a channel - * \param channel channel - * \param cols new number of cols - * \param rows new number of rows - * \warning Do not call it from a signal handler if you are not +/** + * @brief Change the size of the terminal associated to a channel. + * + * @param channel The channel to change the size. + * + * @param cols The new number of columns. + * + * @param rows The new number of rows. + * + * @warning Do not call it from a signal handler if you are not * sure any other libssh function using the same channel/session - * is running at same time (not 100% threadsafe) + * is running at same time (not 100% threadsafe). */ int channel_change_pty_size(CHANNEL *channel, int cols, int rows) { SSH_SESSION *session = channel->session; @@ -1159,16 +1164,10 @@ int channel_change_pty_size(CHANNEL *channel, int cols, int rows) { goto error; } - if (buffer_add_u32(buffer, htonl(cols)) < 0) { - goto error; - } - if (buffer_add_u32(buffer, htonl(rows)) < 0) { - goto error; - } - if (buffer_add_u32(buffer, 0) < 0) { - goto error; - } - if (buffer_add_u32(buffer, 0) < 0) { + if (buffer_add_u32(buffer, htonl(cols)) < 0 || + buffer_add_u32(buffer, htonl(rows)) < 0 || + buffer_add_u32(buffer, 0) < 0 || + buffer_add_u32(buffer, 0) < 0) { goto error; } |