From owner-p4-projects@FreeBSD.ORG Thu Jun 1 15:34:15 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4153216AEF5; Thu, 1 Jun 2006 15:34:15 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DF89616AEDA for ; Thu, 1 Jun 2006 15:34:14 +0000 (UTC) (envelope-from csjp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7333643D4C for ; Thu, 1 Jun 2006 15:34:14 +0000 (GMT) (envelope-from csjp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k51FWl5m030317 for ; Thu, 1 Jun 2006 15:32:47 GMT (envelope-from csjp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k51FWlbx030314 for perforce@freebsd.org; Thu, 1 Jun 2006 15:32:47 GMT (envelope-from csjp@freebsd.org) Date: Thu, 1 Jun 2006 15:32:47 GMT Message-Id: <200606011532.k51FWlbx030314@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to csjp@freebsd.org using -f From: "Christian S.J. Peron" To: Perforce Change Reviews Cc: Subject: PERFORCE change 98267 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jun 2006 15:34:15 -0000 http://perforce.freebsd.org/chv.cgi?CH=98267 Change 98267 by csjp@csjp_xor on 2006/06/01 15:32:20 Check to see if the rootdir is the same as the current working directory. If it is, and the pathname was relative, do not separate the componenets with a '/' character. Affected files ... .. //depot/projects/trustedbsd/audit3/sys/security/audit/audit_bsm_klib.c#9 edit Differences ... ==== //depot/projects/trustedbsd/audit3/sys/security/audit/audit_bsm_klib.c#9 (text+ko) ==== @@ -487,10 +487,11 @@ char *retbuf, *freebuf; struct vnode *vnp; struct filedesc *fdp; - int error, vfslocked; + int cisr, error, vfslocked; fdp = td->td_proc->p_fd; bufp = path; + cisr = 0; FILEDESC_LOCK(fdp); if (*(path) == '/') { while (*(bufp) == '/') @@ -509,6 +510,7 @@ } } else { vnp = fdp->fd_cdir; /* Prepend the current dir. */ + cisr = (fdp->fd_rdir == fdp->fd_cdir); vref(vnp); bufp = path; } @@ -525,8 +527,14 @@ vn_lock(vnp, LK_EXCLUSIVE | LK_RETRY, td); error = vn_fullpath(td, vnp, &retbuf, &freebuf); if (error == 0) { - /* Copy and free buffer allocated by vn_fullpath(). */ - snprintf(cpath, MAXPATHLEN, "%s/%s", retbuf, bufp); + /* Copy and free buffer allocated by vn_fullpath(). + * If the current working directory was the same as + * the root directory, and the path was a relative + * pathname, do not separate the two components with + * the '/' character. + */ + snprintf(cpath, MAXPATHLEN, "%s%s%s", retbuf, + cisr ? "" : "/", bufp); free(freebuf, M_TEMP); } else cpath[0] = '\0';