summaryrefslogtreecommitdiffstats
path: root/libssh
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-11-05 16:08:49 +0100
committerAndreas Schneider <mail@cynapses.org>2009-11-05 16:08:49 +0100
commitf52bc064e9a2d6ce09eaf1ab91090e8d785a88c1 (patch)
tree377b62441500a904a9331e4327d47a659125cebc /libssh
parent8ab0f8e51f9b39205e22c9ecf83f21d19442b200 (diff)
parent75f066dfcd530914fad6b69890b5b4c454d1d1e7 (diff)
downloadlibssh-f52bc064e9a2d6ce09eaf1ab91090e8d785a88c1.tar.gz
libssh-f52bc064e9a2d6ce09eaf1ab91090e8d785a88c1.tar.xz
libssh-f52bc064e9a2d6ce09eaf1ab91090e8d785a88c1.zip
Merge branch 'master' of git://git.libssh.org/projects/libssh/libssh
Diffstat (limited to 'libssh')
-rw-r--r--libssh/channels.c10
-rw-r--r--libssh/crypt.c3
2 files changed, 7 insertions, 6 deletions
diff --git a/libssh/channels.c b/libssh/channels.c
index 6f1e3ee2..229fe205 100644
--- a/libssh/channels.c
+++ b/libssh/channels.c
@@ -1838,7 +1838,8 @@ int channel_read_buffer(ssh_channel channel, ssh_buffer buffer, uint32_t count,
* @param is_stderr A boolean value to mark reading from the stderr flow.
*
* @return The number of bytes read, 0 on end of file or SSH_ERROR on error.
- *
+ * @warning This function may return less than count bytes of data, and won't
+ * block until count bytes have been read.
* @warning The read function using a buffer has been renamed to
* channel_read_buffer().
*/
@@ -1876,9 +1877,10 @@ int channel_read(ssh_channel channel, void *dest, uint32_t count, int is_stderr)
}
}
- /* block reading if asked bytes=0 */
- while (buffer_get_rest_len(stdbuf) == 0 ||
- buffer_get_rest_len(stdbuf) < count) {
+ /* block reading until at least one byte is read
+ * and ignore the trivial case count=0
+ */
+ while (buffer_get_rest_len(stdbuf) == 0 && count > 0) {
if (channel->remote_eof && buffer_get_rest_len(stdbuf) == 0) {
leave_function();
return 0;
diff --git a/libssh/crypt.c b/libssh/crypt.c
index 172d2151..2e05146b 100644
--- a/libssh/crypt.c
+++ b/libssh/crypt.c
@@ -37,10 +37,9 @@
#endif
#include "libssh/priv.h"
-#include "libssh/crypto.h"
#include "libssh/session.h"
#include "libssh/wrapper.h"
-
+#include "libssh/crypto.h"
uint32_t packet_decrypt_len(ssh_session session, char *crypted){
uint32_t decrypted;