[uclibc-ng-devel] common/sendfile.c: bugfix can't support offset is NULL

Message ID 1523605682-13992-1-git-send-email-ren_guo@c-sky.com
State Superseded
Headers show
Series
  • [uclibc-ng-devel] common/sendfile.c: bugfix can't support offset is NULL
Related show

Commit Message

Guo Ren April 13, 2018, 7:48 a.m.
In ltp testcase sendfile08.c, it use offset=NULL to test the api.

See "man sendfile" and it really support offset is NULL.

Signed-off-by: Guo Ren <ren_guo@c-sky.com>
---
 libc/sysdeps/linux/common/sendfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Waldemar Brodkorb April 13, 2018, 3:46 p.m. | #1
Hi Guo,
Guo Ren wrote,

> In ltp testcase sendfile08.c, it use offset=NULL to test the api.
> 
> See "man sendfile" and it really support offset is NULL.
> 
> Signed-off-by: Guo Ren <ren_guo@c-sky.com>

Applied and pushed,
 thx
  Waldemar

Patch

diff --git a/libc/sysdeps/linux/common/sendfile.c b/libc/sysdeps/linux/common/sendfile.c
index af05ba4..def98da 100644
--- a/libc/sysdeps/linux/common/sendfile.c
+++ b/libc/sysdeps/linux/common/sendfile.c
@@ -40,7 +40,7 @@  ssize_t sendfile(int out_fd, int in_fd, __off_t *offset, size_t count)
 		return -1;
 	}
 
-	if (offset == NULL || (int)offset < 0) {
+	if ((int)offset < 0) {
 		__set_errno(EFAULT);
 		return -1;
 	}