diff options
author | alfred <alfred@FreeBSD.org> | 2001-04-26 00:14:14 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2001-04-26 00:14:14 +0000 |
commit | 9b012f16c79435ae88011199434ce8113b1c8c7e (patch) | |
tree | d3a88eb1a09ec026f1952ecdd81519882b220861 | |
parent | 457c353d3c4bb19a8c030099757087cff9c1ea9c (diff) | |
download | FreeBSD-src-9b012f16c79435ae88011199434ce8113b1c8c7e.zip FreeBSD-src-9b012f16c79435ae88011199434ce8113b1c8c7e.tar.gz |
Sendfile is documented to return 0 on success, however if when a
sf_hdtr is used to provide writev(2) style headers/trailers on the
sent data the return value is actually either the result of writev(2)
from the trailers or headers of no tailers are specified.
Fix sendfile to comply with the documentation, by returning 0 on
success.
Ok'd by: dg
-rw-r--r-- | sys/kern/uipc_syscalls.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 33f7902..74e1dc6 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1832,6 +1832,13 @@ retry_space: } done: + /* + * If there was no error we have to clear p->p_retval[0] + * because it may have been set by writev. + */ + if (error == 0) { + p->p_retval[0] = 0; + } if (uap->sbytes != NULL) { copyout(&sbytes, uap->sbytes, sizeof(off_t)); } |