www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: AW: libssh2_channel_read() issue

AW: libssh2_channel_read() issue

From: Belau, Rene (ext) <belau.rene.ext_at_siemens.com>
Date: Wed, 17 Feb 2016 12:27:05 +0000

You need to do an operation and then check session error.

libssh2_scp_recv() //handle null, return -37
libssh2_session_last_errno() //error -28 scp protocol error (libssh2 version 1.5.0) if you have no rights at target device

libssh2_channel_read() //got we some bytes ?
libssh2_session_last_errno() //without error?

libssh2_channel_read() -> 0 bytes => no payload, it is not an error -> libssh2 tells us if it is error ! -> libssh2_session_last_errno()


Rene

Von: libssh2-devel [mailto:libssh2-devel-bounces_at_cool.haxx.se] Im Auftrag von Amirul Islam
Gesendet: Mittwoch, 17. Februar 2016 11:24
An: libssh2-devel_at_cool.haxx.se
Betreff: libssh2_channel_read() issue

Hi All,

I am having an issue with the libssh2_channel_read() function. I am using it in blocking mode to download files from remote server. Now, I have an instance where the file I am trying to download, I do not have read permission. This is causing the read() function to return 0. I am not sure, if I should break my read loop when 0 is returned, since the documentation implies we should break when there is a negative value returned. I am not if breaking on 0 will have unpredictable behavior on other instances. need help

Also, I can check the file mode when I call libssh2_scp_recv() function, what would be the best way to check if my user has read permission?

Thank you in advance.

--

"Fame is a vapor; popularity an accident; the only earthly certainty is oblivion."

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2016-02-17

the libssh2 team