aboutsummaryrefslogtreecommitdiff
path: root/examples/libssh_scp.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cynapses.org>2011-01-06 10:09:38 +0100
committerAndreas Schneider <asn@cynapses.org>2011-01-06 10:15:01 +0100
commitdfa01d086287abe5eba8811697f2326b8a785fe0 (patch)
treef2a4387c9fa79442299e6d304c4f211a25478377 /examples/libssh_scp.c
parent82547867eb573d8b238c031cfa92667613a48266 (diff)
downloadlibssh-dfa01d086287abe5eba8811697f2326b8a785fe0.tar.gz
libssh-dfa01d086287abe5eba8811697f2326b8a785fe0.tar.xz
libssh-dfa01d086287abe5eba8811697f2326b8a785fe0.zip
examples: Use the src mode in scp do_copy function.
Found by clang-analyzer http://test.libssh.org/clang-analyzer/
Diffstat (limited to 'examples/libssh_scp.c')
-rw-r--r--examples/libssh_scp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/libssh_scp.c b/examples/libssh_scp.c
index 83e60b53..c3dc1d62 100644
--- a/examples/libssh_scp.c
+++ b/examples/libssh_scp.c
@@ -182,7 +182,7 @@ static int do_copy(struct location *src, struct location *dest, int recursive){
fd=fileno(src->file);
fstat(fd,&s);
size=s.st_size;
- mode=s.st_mode;
+ mode = s.st_mode & S_IFMT;
filename=ssh_basename(src->path);
} else {
size=0;
@@ -207,7 +207,7 @@ static int do_copy(struct location *src, struct location *dest, int recursive){
}
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);
if(r==SSH_ERROR){
fprintf(stderr,"error: %s\n",ssh_get_error(dest->session));