example: treat the libssh2_channel_read() return code properly

A short read is not an error. Only negative values are errors!
This commit is contained in:
Daniel Stenberg 2010-08-02 00:20:24 +02:00
parent 697b4e8ed7
commit 4b8013a8a7

View File

@ -151,10 +151,10 @@ int main(int argc, char *argv[])
}
rc = libssh2_channel_read(channel, mem, amount);
if(rc == amount) {
if(rc > 0) {
write(1, mem, rc);
}
else {
else if(rc < 0) {
fprintf(stderr, "libssh2_channel_read() failed: %d\n", rc);
break;
}