aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2010-05-31 21:57:31 +0000
committerRobert Watson <rwatson@FreeBSD.org>2010-05-31 21:57:31 +0000
commit1732ca8fb3ba38286da5f1f93f722b70d4cede90 (patch)
tree959deaeae83a67036bf43094701c118df116c0b4 /sys
parentb269c05e018ef478de7a01e0af26c66d943f54e0 (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/vfs_lookup.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index 51985622079d..6f10b49c4181 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -162,11 +162,16 @@ namei(struct nameidata *ndp)
error = copyinstr(ndp->ni_dirp, cnp->cn_pnbuf,
MAXPATHLEN, (size_t *)&ndp->ni_pathlen);
- /* If we are auditing the kernel pathname, save the user pathname. */
- if (cnp->cn_flags & AUDITVNODE1)
- AUDIT_ARG_UPATH1(td, cnp->cn_pnbuf);
- if (cnp->cn_flags & AUDITVNODE2)
- AUDIT_ARG_UPATH2(td, cnp->cn_pnbuf);
+ if (error == 0) {
+ /*
+ * If we are auditing the kernel pathname, save the user
+ * pathname.
+ */
+ if (cnp->cn_flags & AUDITVNODE1)
+ AUDIT_ARG_UPATH1(td, cnp->cn_pnbuf);
+ if (cnp->cn_flags & AUDITVNODE2)
+ AUDIT_ARG_UPATH2(td, cnp->cn_pnbuf);
+ }
/*
* Don't allow empty pathnames.