summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjamie <jamie@FreeBSD.org>2016-06-09 20:39:57 +0000
committerjamie <jamie@FreeBSD.org>2016-06-09 20:39:57 +0000
commit91dc125e2d62a46ec88abc017cb7d8f07c9c166e (patch)
tree32923e1d9df5eb52cc41522b2e74d22c67537c2b
parent57dc7171d01c809423dc85a3479546200b3b3cc8 (diff)
downloadFreeBSD-src-91dc125e2d62a46ec88abc017cb7d8f07c9c166e.zip
FreeBSD-src-91dc125e2d62a46ec88abc017cb7d8f07c9c166e.tar.gz
Clean up some logic in jail error messages, replacing a missing test and
a redundant test with a single correct test.
-rw-r--r--sys/kern/kern_jail.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c
index ea4b628..7bc496e 100644
--- a/sys/kern/kern_jail.c
+++ b/sys/kern/kern_jail.c
@@ -1929,19 +1929,17 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags)
vrele(root);
done_errmsg:
if (error) {
- vfs_getopt(opts, "errmsg", (void **)&errmsg, &errmsg_len);
- if (errmsg_len > 0) {
+ if (vfs_getopt(opts, "errmsg", (void **)&errmsg,
+ &errmsg_len) == 0 && errmsg_len > 0) {
errmsg_pos = 2 * vfs_getopt_pos(opts, "errmsg") + 1;
- if (errmsg_pos > 0) {
- if (optuio->uio_segflg == UIO_SYSSPACE)
- bcopy(errmsg,
- optuio->uio_iov[errmsg_pos].iov_base,
- errmsg_len);
- else
- copyout(errmsg,
- optuio->uio_iov[errmsg_pos].iov_base,
- errmsg_len);
- }
+ if (optuio->uio_segflg == UIO_SYSSPACE)
+ bcopy(errmsg,
+ optuio->uio_iov[errmsg_pos].iov_base,
+ errmsg_len);
+ else
+ copyout(errmsg,
+ optuio->uio_iov[errmsg_pos].iov_base,
+ errmsg_len);
}
}
done_free:
OpenPOWER on IntegriCloud