When using size_t, we get a build warning on this line (ignoring the small mismatch in line numbers):
/builds/xxxxx/php/ext/ssh2/ssh2_fopen_wrappers.c:1254:91: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
1254 | if ((justsent = libssh2_channel_write(remote_file, (buffer + sent), bytesread - sent)) < 0) {
| ^
This PR ensures we use the correct types, both for the libssh2 library call libssh2_channel_write, as well as the internal PHP functions.
Moreover, I've added a check on the number of written bytes in the PHP function for ssh2_scp_recv. (If it's better to add this in another PR, let me know)
Although the streams documentation indicates a return type of
size_t
(and a warning that the prototypes are out of date), the current implementation isssize_t
.When using
size_t
, we get a build warning on this line (ignoring the small mismatch in line numbers):This PR ensures we use the correct types, both for the
libssh2
library calllibssh2_channel_write
, as well as the internal PHP functions.Moreover, I've added a check on the number of written bytes in the PHP function for
ssh2_scp_recv
. (If it's better to add this in another PR, let me know)