From 0e6359c63d966ce37c9dd40a7cb3464c461d8aa5 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 4 May 2009 06:57:15 +0000 Subject: Improve channel_change_pty_size(). git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@695 7dcaeef0-15fb-0310-b436-a5af3365683c --- libssh/channels.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'libssh') diff --git a/libssh/channels.c b/libssh/channels.c index 19e7c08..3571706 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; } -- cgit v1.2.3