I can successfully send files from one end to another using
libssh2_scp_send()
. When I try to receive files using
libssh2_scp_recv()
, though, it does not fill the struct stat
parameter with data. The file size always returns "0".
struct stat file_info;
LIBSSH2_CHANNEL *channel = libssh2_scp_recv( session, source_file, &file_info );
printf( "file_info.st_size = %lu.\n", file_info.st_size );
Any other fields in file_info
come empty too, even though channel
is not NULL.
My session is opened correctly and works for any other SSH operation (running remote comands, sending files...)
I am using "libssh2-1.3.0".
Is there any clue, please?
Really thanks.
EDIT:
I changed the third line to:
fprintf( stderr, "** file_info { st_size = %lu; st_atime = %lu }. SSH last error = %d",
file_info.st_size, file_info.st_atime,
libssh2_session_last_errno( info->session ) );
And the result is:
** file_info { st_size = 0; st_atime = 0 }. SSH last error = 0`.
That's it. The returned channel is valid, I can read from it. libssh2_session_last_errno()
gives no error, but st_size
still comes empty.