mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-07-31 00:03:07 +03:00
examples: Use the src mode in scp do_copy function.
Found by clang-analyzer http://test.libssh.org/clang-analyzer/
This commit is contained in:
@ -182,7 +182,7 @@ static int do_copy(struct location *src, struct location *dest, int recursive){
|
|||||||
fd=fileno(src->file);
|
fd=fileno(src->file);
|
||||||
fstat(fd,&s);
|
fstat(fd,&s);
|
||||||
size=s.st_size;
|
size=s.st_size;
|
||||||
mode=s.st_mode;
|
mode = s.st_mode & S_IFMT;
|
||||||
filename=ssh_basename(src->path);
|
filename=ssh_basename(src->path);
|
||||||
} else {
|
} else {
|
||||||
size=0;
|
size=0;
|
||||||
@ -207,7 +207,7 @@ static int do_copy(struct location *src, struct location *dest, int recursive){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(dest->is_ssh){
|
if(dest->is_ssh){
|
||||||
r=ssh_scp_push_file(dest->scp,src->path,size,0644);
|
r=ssh_scp_push_file(dest->scp,src->path, size, mode);
|
||||||
// snprintf(buffer,sizeof(buffer),"C0644 %d %s\n",size,src->path);
|
// snprintf(buffer,sizeof(buffer),"C0644 %d %s\n",size,src->path);
|
||||||
if(r==SSH_ERROR){
|
if(r==SSH_ERROR){
|
||||||
fprintf(stderr,"error: %s\n",ssh_get_error(dest->session));
|
fprintf(stderr,"error: %s\n",ssh_get_error(dest->session));
|
||||||
|
Reference in New Issue
Block a user