mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-05 20:55:46 +03:00
@@ -84,9 +84,15 @@ static int opts(int argc, char **argv){
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct location *parse_location(char *loc){
|
static struct location *parse_location(char *loc){
|
||||||
struct location *location=malloc(sizeof(struct location));
|
struct location *location;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
|
location = malloc(sizeof(struct location));
|
||||||
|
if (location == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
memset(location, 0, sizeof(struct location));
|
||||||
|
|
||||||
location->host=location->user=NULL;
|
location->host=location->user=NULL;
|
||||||
ptr=strchr(loc,':');
|
ptr=strchr(loc,':');
|
||||||
if(ptr != NULL){
|
if(ptr != NULL){
|
||||||
@@ -123,6 +129,7 @@ static int open_location(struct location *loc, int flag){
|
|||||||
if(ssh_scp_init(loc->scp)==SSH_ERROR){
|
if(ssh_scp_init(loc->scp)==SSH_ERROR){
|
||||||
fprintf(stderr,"error : %s\n",ssh_get_error(loc->session));
|
fprintf(stderr,"error : %s\n",ssh_get_error(loc->session));
|
||||||
ssh_scp_free(loc->scp);
|
ssh_scp_free(loc->scp);
|
||||||
|
loc->scp = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -140,6 +147,7 @@ static int open_location(struct location *loc, int flag){
|
|||||||
if(ssh_scp_init(loc->scp)==SSH_ERROR){
|
if(ssh_scp_init(loc->scp)==SSH_ERROR){
|
||||||
fprintf(stderr,"error : %s\n",ssh_get_error(loc->session));
|
fprintf(stderr,"error : %s\n",ssh_get_error(loc->session));
|
||||||
ssh_scp_free(loc->scp);
|
ssh_scp_free(loc->scp);
|
||||||
|
loc->scp = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user