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:
parent
697b4e8ed7
commit
4b8013a8a7
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user