aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-08-13 08:15:37 +0200
committerAndreas Schneider <asn@cryptomilk.org>2013-08-13 08:15:37 +0200
commit5045133dc21af0d6ebed6edc43c091e3c8d9d0ce (patch)
tree9b30d0d28789ded0636b952b7dd0facbd8529c56 /src
parent7f2049b0d5f75fdd6ee868aee9742597b26a2389 (diff)
downloadlibssh-5045133dc21af0d6ebed6edc43c091e3c8d9d0ce.tar.gz
libssh-5045133dc21af0d6ebed6edc43c091e3c8d9d0ce.tar.xz
libssh-5045133dc21af0d6ebed6edc43c091e3c8d9d0ce.zip
channel: Use MIN macro in channel_write_common().
Diffstat (limited to 'src')
-rw-r--r--src/channels.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/channels.c b/src/channels.c
index f5b71a0a..11792a99 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -1319,11 +1319,13 @@ int channel_write_common(ssh_channel channel, const void *data,
goto out;
continue;
}
- effectivelen = len > channel->remote_window ? channel->remote_window : len;
+ effectivelen = MIN(len, channel->remote_window);
} else {
effectivelen = len;
}
- effectivelen = effectivelen > maxpacketlen ? maxpacketlen : effectivelen;
+
+ effectivelen = MIN(effectivelen, maxpacketlen);;
+
if (buffer_add_u8(session->out_buffer, is_stderr ?
SSH2_MSG_CHANNEL_EXTENDED_DATA : SSH2_MSG_CHANNEL_DATA) < 0 ||
buffer_add_u32(session->out_buffer,