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