1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-08-07 08:02:55 +03:00

examples: Check return value of fileno().

This commit is contained in:
Andreas Schneider
2013-06-19 12:32:10 +02:00
parent 36e4c2e5bc
commit 89be6d0309

View File

@@ -180,6 +180,10 @@ static int do_copy(struct location *src, struct location *dest, int recursive){
/* Get the file name and size*/
if(!src->is_ssh){
fd = fileno(src->file);
if (fd < 0) {
fprintf(stderr, "Invalid file pointer, error: %s\n", strerror(errno));
return -1;
}
fstat(fd,&s);
size=s.st_size;
mode = s.st_mode & ~S_IFMT;