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
This commit is contained in:
Alfred Perlstein 2001-04-26 00:14:14 +00:00
parent 9ca3a84af2
commit 06336fb26d

View File

@ -1832,6 +1832,13 @@ sendfile(struct proc *p, struct sendfile_args *uap)
}
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));
}