On Fri, Nov 30, 2012 at 11:18:49PM +0000, Pawel Jakub Dawidek wrote: > Modified: head/sys/security/audit/audit_bsm_klib.c > ============================================================================== > --- head/sys/security/audit/audit_bsm_klib.c Fri Nov 30 23:13:56 2012 > (r243725) > +++ head/sys/security/audit/audit_bsm_klib.c Fri Nov 30 23:18:49 2012 > (r243726) > @@ -462,13 +462,13 @@ auditon_command_event(int cmd) > * leave the filename starting with '/' in the audit log in this case. > */ > void > -audit_canon_path(struct thread *td, char *path, char *cpath) > +audit_canon_path(struct thread *td, int dirfd, char *path, char *cpath) > { > struct vnode *cvnp, *rvnp; > char *rbuf, *fbuf, *copy; > struct filedesc *fdp; > struct sbuf sbf; > - int error, cwir; > + int error, needslash, vfslocked; > > WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "%s: at %s:%d", > __func__, __FILE__, __LINE__); > @@ -491,10 +491,27 @@ audit_canon_path(struct thread *td, char > * path. > */ > if (*path != '/') { > - cvnp = fdp->fd_cdir; > - vhold(cvnp); > + if (dirfd == AT_FDCWD) { > + cvnp = fdp->fd_cdir; > + vhold(cvnp); > + } else { > + /* XXX: fgetvp() that vhold()s vnode instead of > vref()ing it would be better */ This line is too long. > + error = fgetvp(td, dirfd, 0, &cvnp); > + if (error) { > + cpath[0] = '\0'; > + if (rvnp != NULL) > + vdrop(rvnp); > + return; > + } > + vhold(cvnp); > + vfslocked = VFS_LOCK_GIANT(cvnp->v_mount); > + vrele(cvnp); > + VFS_UNLOCK_GIANT(vfslocked); And this cannot compile.
pgpdSccrU8Jh2.pgp
Description: PGP signature