From f31d6316f6fc443e03ca68cba934d67d1eab46fc Mon Sep 17 00:00:00 2001 From: christos Date: Fri, 14 Oct 2005 17:18:59 +0000 Subject: [PATCH] No need for __UNCONST in previous commit; factor out the function call. --- sys/kern/vfs_vnops.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 3328d49842f8..72045c60b8bf 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_vnops.c,v 1.96 2005/10/14 12:47:04 elad Exp $ */ +/* $NetBSD: vfs_vnops.c,v 1.97 2005/10/14 17:18:59 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.96 2005/10/14 12:47:04 elad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.97 2005/10/14 17:18:59 christos Exp $"); #include "opt_verified_exec.h" @@ -106,19 +106,16 @@ vn_open(struct nameidata *ndp, int fmode, int cmode) struct veriexec_hash_entry *vhe = NULL; char pathbuf[MAXPATHLEN]; size_t pathlen; + void (*copyfun)(const void *, void *, size_t, size_t *) = + ndp->ni_segflg == UIO_SYSSPACE ? copystr : copyinstr; #endif /* VERIFIED_EXEC */ #ifdef VERIFIED_EXEC - if (ndp->ni_segflg == UIO_SYSSPACE) - error = copystr(__UNCONST(ndp->ni_dirp), pathbuf, - sizeof(pathbuf), &pathlen); - else - error = copyinstr(__UNCONST(ndp->ni_dirp), pathbuf, - sizeof(pathbuf), &pathlen); + error = (*copyfun)(ndp->ni_dirp, pathbuf, sizeof(pathbuf), &pathlen); if (error) { if (veriexec_verbose >= 1) printf("veriexec: Can't copy path. (error=%d)\n", - error); + error); return (error); }