aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-07-14 15:01:06 +0200
committerAndreas Schneider <asn@cryptomilk.org>2013-07-14 15:02:11 +0200
commit351e4107ed381aa699af1abe499d9b0994a7ab10 (patch)
treeb4439b81ef6e592f2fc05eae052bac97deef9884 /examples
parent776ff528df2e363fd12a8fbaae2489956f676bee (diff)
downloadlibssh-351e4107ed381aa699af1abe499d9b0994a7ab10.tar.gz
libssh-351e4107ed381aa699af1abe499d9b0994a7ab10.tar.xz
libssh-351e4107ed381aa699af1abe499d9b0994a7ab10.zip
examples: Check return value of fstat().
CID #743297
Diffstat (limited to 'examples')
-rw-r--r--examples/libssh_scp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/libssh_scp.c b/examples/libssh_scp.c
index 9027ef99..99281db8 100644
--- a/examples/libssh_scp.c
+++ b/examples/libssh_scp.c
@@ -192,7 +192,10 @@ static int do_copy(struct location *src, struct location *dest, int recursive){
fprintf(stderr, "Invalid file pointer, error: %s\n", strerror(errno));
return -1;
}
- fstat(fd,&s);
+ r = fstat(fd, &s);
+ if (r < 0) {
+ return -1;
+ }
size=s.st_size;
mode = s.st_mode & ~S_IFMT;
filename=ssh_basename(src->path);