1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-07-28 01:41:48 +03:00

Fix warnings found with clang analyzer

This commit is contained in:
Aris Adamantiadis
2010-04-28 19:36:39 +02:00
parent 20e7ec96ae
commit 7d32ec5d28
5 changed files with 26 additions and 7 deletions

View File

@ -53,7 +53,7 @@ static int auth_callback(const char *prompt, char *buf, size_t len,
if (echo) {
while ((answer = fgets(buf, len, stdin)) == NULL);
if ((ptr = strchr(buf, '\n'))) {
ptr = '\0';
*ptr = '\0';
}
} else {
answer = getpass(prompt);

View File

@ -882,7 +882,7 @@ static int match(const char *group, const char *object){
const char *a;
const char *z;
a = z = group;
z = group;
do {
a = strchr(z, ',');
if (a == NULL) {

View File

@ -126,7 +126,7 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user)
char buffer[16] = {0};
void *packet=NULL;
int to_be_read;
int rc = SSH_ERROR;
int rc;
uint32_t len;
uint8_t padding;
size_t processed=0; /* number of byte processed from the callback */
@ -187,7 +187,6 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user)
/* give up, not enough data in buffer */
return processed;
}
rc = SSH_ERROR;
packet = (unsigned char *)data + processed;
// ssh_socket_read(session->socket,packet,to_be_read-current_macsize);

View File

@ -112,6 +112,11 @@ int ssh_scp_init(ssh_scp scp){
}
if(scp->mode == SSH_SCP_WRITE){
r=channel_read(scp->channel,&code,1,0);
if(r<=0){
ssh_set_error(scp->session,SSH_FATAL, "Error reading status code: %s",ssh_get_error(scp->session));
scp->state=SSH_SCP_ERROR;
return SSH_ERROR;
}
if(code != 0){
ssh_set_error(scp->session,SSH_FATAL, "scp status code %ud not valid", code);
scp->state=SSH_SCP_ERROR;
@ -207,6 +212,11 @@ int ssh_scp_push_directory(ssh_scp scp, const char *dirname, int mode){
return SSH_ERROR;
}
r=channel_read(scp->channel,&code,1,0);
if(r<=0){
ssh_set_error(scp->session,SSH_FATAL, "Error reading status code: %s",ssh_get_error(scp->session));
scp->state=SSH_SCP_ERROR;
return SSH_ERROR;
}
if(code != 0){
ssh_set_error(scp->session,SSH_FATAL, "scp status code %ud not valid", code);
scp->state=SSH_SCP_ERROR;
@ -239,6 +249,11 @@ int ssh_scp_push_directory(ssh_scp scp, const char *dirname, int mode){
return SSH_ERROR;
}
r=channel_read(scp->channel,&code,1,0);
if(r<=0){
ssh_set_error(scp->session,SSH_FATAL, "Error reading status code: %s",ssh_get_error(scp->session));
scp->state=SSH_SCP_ERROR;
return SSH_ERROR;
}
if(code != 0){
ssh_set_error(scp->session,SSH_FATAL, "scp status code %ud not valid", code);
scp->state=SSH_SCP_ERROR;
@ -286,6 +301,11 @@ int ssh_scp_push_file(ssh_scp scp, const char *filename, size_t size, int mode){
return SSH_ERROR;
}
r=channel_read(scp->channel,&code,1,0);
if(r<=0){
ssh_set_error(scp->session,SSH_FATAL, "Error reading status code: %s",ssh_get_error(scp->session));
scp->state=SSH_SCP_ERROR;
return SSH_ERROR;
}
if(code != 0){
ssh_set_error(scp->session,SSH_FATAL, "scp status code %ud not valid", code);
scp->state=SSH_SCP_ERROR;

View File

@ -2400,9 +2400,9 @@ int sftp_rename(sftp_session sftp, const char *original, const char *newname) {
/* Code written by Nick */
/* Set file attributes on a file, directory or symbolic link. */
int sftp_setstat(sftp_session sftp, const char *file, sftp_attributes attr) {
uint32_t id = sftp_get_new_id(sftp);
ssh_buffer buffer = buffer_new();
ssh_string path = string_from_char(file);
uint32_t id;
ssh_buffer buffer;
ssh_string path;
sftp_message msg = NULL;
sftp_status_message status = NULL;