summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2014-07-28 20:30:02 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2014-07-28 20:30:02 +0000
commit527c4f3e3dab2b4d0222fe60fb0e50e1fcc18d17 (patch)
tree850effffbe50e9c2a3886edb305d18600bec7b6d /sys
parentb57fb5f84ced9975f5181a6b19deacd0e209c1c2 (diff)
I/O ktrace of sendsyslog(2) did not work. As uiomove() adjusts
iov_len to 0, we need a propper length calculation. While there, use -1 for the file descriptor because 0 is reserved for stdin. OK deraadt@ guenther@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/subr_log.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c
index b64872a82d8..55d8fcab89b 100644
--- a/sys/kern/subr_log.c
+++ b/sys/kern/subr_log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_log.c,v 1.21 2014/07/12 18:43:32 tedu Exp $ */
+/* $OpenBSD: subr_log.c,v 1.22 2014/07/28 20:30:01 bluhm Exp $ */
/* $NetBSD: subr_log.c,v 1.11 1996/03/30 22:24:44 christos Exp $ */
/*
@@ -349,6 +349,7 @@ sys_sendsyslog(struct proc *p, void *v, register_t *retval)
struct iovec aiov;
struct uio auio;
struct file *f;
+ size_t len;
int error;
if (syslogf == NULL)
@@ -374,12 +375,15 @@ sys_sendsyslog(struct proc *p, void *v, register_t *retval)
}
#endif
+ len = auio.uio_resid;
error = sosend(f->f_data, NULL, &auio, NULL, NULL, 0);
+ if (error == 0)
+ len -= auio.uio_resid;
#ifdef KTRACE
if (ktriov != NULL) {
if (error == 0)
- ktrgenio(p, 0, UIO_WRITE, ktriov, aiov.iov_len);
+ ktrgenio(p, -1, UIO_WRITE, ktriov, len);
free(ktriov, M_TEMP, 0);
}
#endif