SFTP: more types to uint32_t

The 'num_names' field in the SSH_FXP_NAME response is an unsigned 32bit
value so we make sure to treat it like that.
This commit is contained in:
Daniel Stenberg 2010-12-15 09:31:37 +01:00
parent 3faa8bc940
commit b3e832172b
2 changed files with 5 additions and 4 deletions

View File

@ -1317,7 +1317,8 @@ static int sftp_readdir(LIBSSH2_SFTP_HANDLE *handle, char *buffer,
LIBSSH2_SFTP *sftp = handle->sftp;
LIBSSH2_CHANNEL *channel = sftp->channel;
LIBSSH2_SESSION *session = channel->session;
size_t data_len, filename_len, longentry_len, num_names;
size_t data_len, filename_len, longentry_len;
uint32_t num_names;
/* 13 = packet_len(4) + packet_type(1) + request_id(4) + handle_len(4) */
ssize_t packet_len = handle->handle_len + 13;
unsigned char *s, *data;
@ -1449,9 +1450,9 @@ static int sftp_readdir(LIBSSH2_SFTP_HANDLE *handle, char *buffer,
num_names = _libssh2_ntohu32(data + 5);
_libssh2_debug(session, LIBSSH2_TRACE_SFTP, "%lu entries returned",
num_names);
if (num_names <= 0) {
if (!num_names) {
LIBSSH2_FREE(session, data);
return (num_names == 0) ? 0 : -1;
return 0;
}
handle->u.dir.names_left = num_names;

View File

@ -112,7 +112,7 @@ struct _LIBSSH2_SFTP_HANDLE
} file;
struct _libssh2_sftp_handle_dir_data
{
unsigned long names_left;
uint32_t names_left;
void *names_packet;
char *next_name;
} dir;