diff --git a/fs/vfs/fs_sendfile.c b/fs/vfs/fs_sendfile.c index 5b4ec2cff5..ac460a63bf 100644 --- a/fs/vfs/fs_sendfile.c +++ b/fs/vfs/fs_sendfile.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -244,6 +245,12 @@ static ssize_t copyfile(FAR struct file *outfile, FAR struct file *infile, ssize_t file_sendfile(FAR struct file *outfile, FAR struct file *infile, off_t *offset, size_t count) { + if (count == 0) + { + nwarn("WARNING: sendfile count is zero\n"); + return 0; + } + #ifdef CONFIG_NET_SENDFILE /* Check the destination file descriptor: Is it a (probable) file * descriptor? Check the source file: Is it a normal file?