linux_util.c (64913) | linux_util.c (70061) |
---|---|
1/* 2 * Copyright (c) 1994 Christos Zoulas 3 * Copyright (c) 1995 Frank van der Linden 4 * Copyright (c) 1995 Scott Bartram 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 13 unchanged lines hidden (view full) --- 22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * 29 * from: svr4_util.c,v 1.5 1995/01/22 23:44:50 christos Exp | 1/* 2 * Copyright (c) 1994 Christos Zoulas 3 * Copyright (c) 1995 Frank van der Linden 4 * Copyright (c) 1995 Scott Bartram 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 13 unchanged lines hidden (view full) --- 22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * 29 * from: svr4_util.c,v 1.5 1995/01/22 23:44:50 christos Exp |
30 * $FreeBSD: head/sys/compat/linux/linux_util.c 64913 2000-08-22 01:51:54Z marcel $ | 30 * $FreeBSD: head/sys/compat/linux/linux_util.c 70061 2000-12-15 19:41:27Z jhb $ |
31 */ 32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/namei.h> 36#include <sys/proc.h> 37#include <sys/malloc.h> 38#include <sys/vnode.h> --- 18 unchanged lines hidden (view full) --- 57 char *path; 58 char **pbuf; 59 int cflag; 60{ 61 struct nameidata nd; 62 struct nameidata ndroot; 63 struct vattr vat; 64 struct vattr vatroot; | 31 */ 32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/namei.h> 36#include <sys/proc.h> 37#include <sys/malloc.h> 38#include <sys/vnode.h> --- 18 unchanged lines hidden (view full) --- 57 char *path; 58 char **pbuf; 59 int cflag; 60{ 61 struct nameidata nd; 62 struct nameidata ndroot; 63 struct vattr vat; 64 struct vattr vatroot; |
65 struct ucred *uc; |
|
65 int error; 66 char *ptr, *buf, *cp; 67 size_t sz, len; 68 69 buf = (char *) malloc(MAXPATHLEN, M_TEMP, M_WAITOK); 70 *pbuf = path; 71 72 for (ptr = buf; (*ptr = *prefix) != '\0'; ptr++, prefix++) --- 62 unchanged lines hidden (view full) --- 135 if ((error = namei(&ndroot)) != 0) { 136 /* Cannot happen! */ 137 free(buf, M_TEMP); 138 NDFREE(&nd, NDF_ONLY_PNBUF); 139 vrele(nd.ni_vp); 140 return error; 141 } 142 | 66 int error; 67 char *ptr, *buf, *cp; 68 size_t sz, len; 69 70 buf = (char *) malloc(MAXPATHLEN, M_TEMP, M_WAITOK); 71 *pbuf = path; 72 73 for (ptr = buf; (*ptr = *prefix) != '\0'; ptr++, prefix++) --- 62 unchanged lines hidden (view full) --- 136 if ((error = namei(&ndroot)) != 0) { 137 /* Cannot happen! */ 138 free(buf, M_TEMP); 139 NDFREE(&nd, NDF_ONLY_PNBUF); 140 vrele(nd.ni_vp); 141 return error; 142 } 143 |
143 if ((error = VOP_GETATTR(nd.ni_vp, &vat, p->p_ucred, p)) != 0) { | 144 PROC_LOCK(p); 145 uc = p->p_ucred; 146 crhold(uc); 147 PROC_UNLOCK(p); 148 if ((error = VOP_GETATTR(nd.ni_vp, &vat, uc, p)) != 0) { 149 crfree(uc); |
144 goto bad; 145 } 146 | 150 goto bad; 151 } 152 |
147 if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, p->p_ucred, p)) 148 != 0) { | 153 error = VOP_GETATTR(ndroot.ni_vp, &vatroot, uc, p); 154 crfree(uc); 155 if (error != 0) { |
149 goto bad; 150 } 151 152 if (vat.va_fsid == vatroot.va_fsid && 153 vat.va_fileid == vatroot.va_fileid) { 154 error = ENOENT; 155 goto bad; 156 } --- 30 unchanged lines hidden --- | 156 goto bad; 157 } 158 159 if (vat.va_fsid == vatroot.va_fsid && 160 vat.va_fileid == vatroot.va_fileid) { 161 error = ENOENT; 162 goto bad; 163 } --- 30 unchanged lines hidden --- |