diff options
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/common/compat_util.c | 57 | ||||
-rw-r--r-- | sys/compat/freebsd/freebsd_syscallargs.h | 2 | ||||
-rw-r--r-- | sys/compat/freebsd/freebsd_sysent.c | 2 | ||||
-rw-r--r-- | sys/compat/ultrix/ultrix_misc.c | 6 |
4 files changed, 31 insertions, 36 deletions
diff --git a/sys/compat/common/compat_util.c b/sys/compat/common/compat_util.c index 0f42413ef00..c2fe362c80b 100644 --- a/sys/compat/common/compat_util.c +++ b/sys/compat/common/compat_util.c @@ -1,4 +1,4 @@ -/* $NetBSD: compat_util.c,v 1.2 1995/06/26 19:27:17 christos Exp $ */ +/* $NetBSD: compat_util.c,v 1.2.2.1 1995/10/22 08:22:47 mycroft Exp $ */ /* * Copyright (c) 1994 Christos Zoulas @@ -85,14 +85,12 @@ emul_find(p, sgp, prefix, path, pbuf, cflag) else error = copyinstr(path, ptr, sz, &len); - if (error) { - free(buf, M_TEMP); - return error; - } + if (error) + goto bad; if (*ptr != '/') { - free(buf, M_TEMP); - return EINVAL; + error = EINVAL; + goto bad; } /* @@ -104,25 +102,22 @@ emul_find(p, sgp, prefix, path, pbuf, cflag) */ if (cflag) { - for (cp = &ptr[len] - 1; *cp != '/'; cp--); + for (cp = &ptr[len] - 1; *cp != '/'; cp--) + ; *cp = '\0'; NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, p); - if ((error = namei(&nd)) != 0) { - free(buf, M_TEMP); - return error; - } + if ((error = namei(&nd)) != 0) + goto bad; *cp = '/'; } else { NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, p); - if ((error = namei(&nd)) != 0) { - free(buf, M_TEMP); - return error; - } + if ((error = namei(&nd)) != 0) + goto bad; /* * We now compare the vnode of the emulation root to the one @@ -136,28 +131,21 @@ emul_find(p, sgp, prefix, path, pbuf, cflag) NDINIT(&ndroot, LOOKUP, FOLLOW, UIO_SYSSPACE, (char *) prefix, p); - if ((error = namei(&ndroot)) != 0) { - /* Cannot happen! */ - free(buf, M_TEMP); - vrele(nd.ni_vp); - return error; - } + if ((error = namei(&ndroot)) != 0) + goto bad2; - if ((error = VOP_GETATTR(nd.ni_vp, &vat, p->p_ucred, p)) != 0) { - goto done; - } + if ((error = VOP_GETATTR(nd.ni_vp, &vat, p->p_ucred, p)) != 0) + goto bad3; if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, p->p_ucred, p)) - != 0) { - goto done; - } + != 0) + goto bad3; if (vat.va_fsid == vatroot.va_fsid && vat.va_fileid == vatroot.va_fileid) { error = ENOENT; - goto done; + goto bad3; } - } if (sgp == NULL) *pbuf = buf; @@ -168,10 +156,17 @@ emul_find(p, sgp, prefix, path, pbuf, cflag) free(buf, M_TEMP); } - done: vrele(nd.ni_vp); if (!cflag) vrele(ndroot.ni_vp); return error; + +bad3: + vrele(ndroot.ni_vp); +bad2: + vrele(nd.ni_vp); +bad: + free(buf, M_TEMP); + return error; } diff --git a/sys/compat/freebsd/freebsd_syscallargs.h b/sys/compat/freebsd/freebsd_syscallargs.h index c5282a88374..8cd71d90c08 100644 --- a/sys/compat/freebsd/freebsd_syscallargs.h +++ b/sys/compat/freebsd/freebsd_syscallargs.h @@ -239,7 +239,7 @@ int sys_fchflags __P((struct proc *, void *, register_t *)); int sys_sync __P((struct proc *, void *, register_t *)); int sys_kill __P((struct proc *, void *, register_t *)); int compat_43_freebsd_sys_stat __P((struct proc *, void *, register_t *)); -int getppid __P((struct proc *, void *, register_t *)); +int sys_getppid __P((struct proc *, void *, register_t *)); int compat_43_freebsd_sys_lstat __P((struct proc *, void *, register_t *)); int sys_dup __P((struct proc *, void *, register_t *)); int sys_pipe __P((struct proc *, void *, register_t *)); diff --git a/sys/compat/freebsd/freebsd_sysent.c b/sys/compat/freebsd/freebsd_sysent.c index c27f763b7c3..651817e1d84 100644 --- a/sys/compat/freebsd/freebsd_sysent.c +++ b/sys/compat/freebsd/freebsd_sysent.c @@ -95,7 +95,7 @@ struct sysent freebsd_sysent[] = { { 2, s(struct compat_43_freebsd_sys_stat_args), compat_43_freebsd_sys_stat }, /* 38 = ostat */ { 0, 0, - getppid }, /* 39 = getppid */ + sys_getppid }, /* 39 = getppid */ { 2, s(struct compat_43_freebsd_sys_lstat_args), compat_43_freebsd_sys_lstat }, /* 40 = olstat */ { 1, s(struct sys_dup_args), diff --git a/sys/compat/ultrix/ultrix_misc.c b/sys/compat/ultrix/ultrix_misc.c index 620d3fef5d1..9a42e7bbaab 100644 --- a/sys/compat/ultrix/ultrix_misc.c +++ b/sys/compat/ultrix/ultrix_misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ultrix_misc.c,v 1.16 1995/10/07 06:28:02 mycroft Exp $ */ +/* $NetBSD: ultrix_misc.c,v 1.16.2.1 1995/10/18 06:46:14 jonathan Exp $ */ /* * Copyright (c) 1992, 1993 @@ -381,8 +381,8 @@ ultrix_sys_open(p, v, retval) int noctty; int ret; - /* convert mode into NetBSD mode */ - l = SCARG(uap, mode); + /* convert open flags into NetBSD flags */ + l = SCARG(uap, flags); noctty = l & 0x8000; r = (l & (0x0001 | 0x0002 | 0x0008 | 0x0040 | 0x0200 | 0x0400 | 0x0800)); r |= ((l & (0x0004 | 0x1000 | 0x4000)) ? O_NONBLOCK : 0); |