1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-06-03 14:42:01 +03:00

examples: Check return value of fstat().

CID #743297
This commit is contained in:
Andreas Schneider 2013-07-14 15:01:06 +02:00
parent 776ff528df
commit 351e4107ed

View File

@ -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);