summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common
diff options
context:
space:
mode:
authorGuo Ren <ren_guo@c-sky.com>2018-04-16 15:35:20 +0800
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2018-04-17 18:14:00 +0100
commit343fb004d9af1e68416da7c3d836715f684792b0 (patch)
treec75d637e6b3850298be6120f437e10730741f6be /libc/sysdeps/linux/common
parent2d8a38e1a098788c166dfd920cbcda4e7f9adf71 (diff)
common/sendfile.c: bugfix can't support offset is NULL
In ltp testcase sendfile08.c, it use offset=NULL to test the api. PATCH V2: fixup the stupid missing check in the end. Sorry for lose test. See "man sendfile" and it really support offset is NULL. Signed-off-by: Guo Ren <ren_guo@c-sky.com>
Diffstat (limited to 'libc/sysdeps/linux/common')
-rw-r--r--libc/sysdeps/linux/common/sendfile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libc/sysdeps/linux/common/sendfile.c b/libc/sysdeps/linux/common/sendfile.c
index af05ba4e7..f0372c185 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;
}
@@ -54,7 +54,7 @@ ssize_t sendfile(int out_fd, int in_fd, __off_t *offset, size_t count)
res = INLINE_SYSCALL(sendfile64, 4, out_fd, in_fd, off, count);
- if (res >= 0)
+ if (res >= 0 && offset != NULL)
*offset = off64;
return res;