make sure that the pseudo_set isn't empty.
[unix-history] / sys / kern / vfs_syscalls.c
index 22b3a87..441b51c 100644 (file)
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *     from: @(#)vfs_syscalls.c        7.74 (Berkeley) 6/21/91
  * SUCH DAMAGE.
  *
  *     from: @(#)vfs_syscalls.c        7.74 (Berkeley) 6/21/91
- *     $Id: vfs_syscalls.c,v 1.13 1994/05/22 22:31:52 ache Exp $
+ *     $Id: vfs_syscalls.c,v 1.16 1994/05/26 04:46:47 ache Exp $
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -846,8 +846,6 @@ link(p, uap, retval)
                goto out1;
        }
        ndp->ni_nameiop = CREATE | LOCKPARENT;
                goto out1;
        }
        ndp->ni_nameiop = CREATE | LOCKPARENT;
-       if (vp->v_type == VDIR)
-               ndp->ni_nameiop |= WILLBEDIR;
        ndp->ni_dirp = (caddr_t)uap->linkname;
        if (error = namei(ndp, p))
                goto out1;
        ndp->ni_dirp = (caddr_t)uap->linkname;
        if (error = namei(ndp, p))
                goto out1;
@@ -998,37 +996,33 @@ lseek(p, uap, retval)
        register struct file *fp;
        struct vattr vattr;
        int error;
        register struct file *fp;
        struct vattr vattr;
        int error;
-       off_t offset;
 
        if ((unsigned)uap->fdes >= fdp->fd_nfiles ||
            (fp = fdp->fd_ofiles[uap->fdes]) == NULL)
                return (EBADF);
        if (fp->f_type != DTYPE_VNODE)
                return (ESPIPE);
 
        if ((unsigned)uap->fdes >= fdp->fd_nfiles ||
            (fp = fdp->fd_ofiles[uap->fdes]) == NULL)
                return (EBADF);
        if (fp->f_type != DTYPE_VNODE)
                return (ESPIPE);
-       offset = fp->f_offset;
        switch (uap->sbase) {
 
        case L_INCR:
        switch (uap->sbase) {
 
        case L_INCR:
-               offset += uap->off;
+               fp->f_offset += uap->off;
                break;
 
        case L_XTND:
                if (error = VOP_GETATTR((struct vnode *)fp->f_data,
                    &vattr, cred, p))
                        return (error);
                break;
 
        case L_XTND:
                if (error = VOP_GETATTR((struct vnode *)fp->f_data,
                    &vattr, cred, p))
                        return (error);
-               offset = uap->off + vattr.va_size;
+               fp->f_offset = uap->off + vattr.va_size;
                break;
 
        case L_SET:
                break;
 
        case L_SET:
-               offset = uap->off;
+               fp->f_offset = uap->off;
                break;
 
        default:
                return (EINVAL);
        }
                break;
 
        default:
                return (EINVAL);
        }
-       if (offset < 0)
-               return (EINVAL);
-       *retval = fp->f_offset = offset;
+       *retval = fp->f_offset;
        return (0);
 }
 
        return (0);
 }
 
@@ -1639,8 +1633,6 @@ rename(p, uap, retval)
                return (error);
        fvp = fromnd.ni_vp;
        tond.ni_nameiop = RENAME | LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART;
                return (error);
        fvp = fromnd.ni_vp;
        tond.ni_nameiop = RENAME | LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART;
-       if (fvp->v_type == VDIR)
-               tond.ni_nameiop |= WILLBEDIR;
        tond.ni_segflg = UIO_USERSPACE;
        tond.ni_dirp = uap->to;
        if (error = namei(&tond, p)) {
        tond.ni_segflg = UIO_USERSPACE;
        tond.ni_dirp = uap->to;
        if (error = namei(&tond, p)) {
@@ -1670,7 +1662,6 @@ rename(p, uap, retval)
        }
        if (fvp == tdvp)
                error = EINVAL;
        }
        if (fvp == tdvp)
                error = EINVAL;
-#if 0
        /*
         * If source is the same as the destination (that is the
         * same inode number with the same name in the same directory),
        /*
         * If source is the same as the destination (that is the
         * same inode number with the same name in the same directory),
@@ -1680,15 +1671,6 @@ rename(p, uap, retval)
            fromnd.ni_namelen == tond.ni_namelen &&
            !bcmp(fromnd.ni_ptr, tond.ni_ptr, fromnd.ni_namelen))
                error = -1;
            fromnd.ni_namelen == tond.ni_namelen &&
            !bcmp(fromnd.ni_ptr, tond.ni_ptr, fromnd.ni_namelen))
                error = -1;
-#else
-       /*
-        * If the source is the same as the destination (that is, if they
-        * are links to the same vnode), then there is nothing to do.
-        * POSIX standard.
-        */
-       if (fvp == tvp)
-               error = -1;
-#endif
 out:
        if (!error) {
                error = VOP_RENAME(&fromnd, &tond, p);
 out:
        if (!error) {
                error = VOP_RENAME(&fromnd, &tond, p);
@@ -1738,7 +1720,7 @@ mkdir(p, uap, retval)
        struct nameidata nd;
 
        ndp = &nd;
        struct nameidata nd;
 
        ndp = &nd;
-       ndp->ni_nameiop = CREATE | LOCKPARENT | WILLBEDIR;
+       ndp->ni_nameiop = CREATE | LOCKPARENT;
        ndp->ni_segflg = UIO_USERSPACE;
        ndp->ni_dirp = uap->name;
        if (error = namei(ndp, p))
        ndp->ni_segflg = UIO_USERSPACE;
        ndp->ni_dirp = uap->name;
        if (error = namei(ndp, p))