diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2013-07-14 15:01:06 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2013-07-14 15:02:11 +0200 |
commit | 351e4107ed381aa699af1abe499d9b0994a7ab10 (patch) | |
tree | b4439b81ef6e592f2fc05eae052bac97deef9884 /examples | |
parent | 776ff528df2e363fd12a8fbaae2489956f676bee (diff) | |
download | libssh-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.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/libssh_scp.c b/examples/libssh_scp.c index 9027ef9..99281db 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); |