]> Zhao Yanbai Git Server - minix.git/commitdiff
AVFS: reinitialize lookup object before reuse
authorThomas Veerman <thomas@minix3.org>
Fri, 10 Feb 2012 09:35:19 +0000 (09:35 +0000)
committerThomas Veerman <thomas@minix3.org>
Fri, 10 Feb 2012 09:50:21 +0000 (09:50 +0000)
servers/avfs/link.c
servers/avfs/open.c

index 4dc72b4b30fcac6b00f1f6b248dd7b9e2cf1a1d1..1c0b4af86af547e3cd4725fd13a048939dbd9432 100644 (file)
@@ -191,12 +191,9 @@ PUBLIC int do_rename()
      user is allowed to rename */
   if ((old_dirp->v_mode & S_ISVTX) == S_ISVTX) {
        /* Look up inode of file to unlink to retrieve owner */
-       resolve.l_flags = PATH_RET_SYMLINK;
-       resolve.l_vmp = &vmp2;  /* Shouldn't actually get locked */
+       lookup_init(&resolve, resolve.l_path, PATH_RET_SYMLINK, &vmp2, &vp);
        resolve.l_vmnt_lock = VMNT_READ;
-       resolve.l_vnode = &vp;
        resolve.l_vnode_lock = VNODE_READ;
-       resolve.l_flags = PATH_RET_SYMLINK;
        vp = advance(old_dirp, &resolve, fp);
        assert(vmp2 == NULL);
        if (vp != NULL) {
index d0c652108cc5beb3be2f4f21c4583dd034a3c022..a3fd9dc24c05b81b06ae60efb4060153ff59aa55 100644 (file)
@@ -317,8 +317,8 @@ PRIVATE struct vnode *new_node(struct lookup *resolve, int oflags, mode_t bits)
   if ((dirp = last_dir(&findnode, fp)) == NULL) return(NULL);
 
   /* The final directory is accessible. Get final component of the path. */
-  findnode.l_vmp = &vp_vmp;
-  findnode.l_vnode = &vp;
+  lookup_init(&findnode, findnode.l_path, findnode.l_flags, &vp_vmp, &vp);
+  findnode.l_vmnt_lock = VMNT_WRITE;
   findnode.l_vnode_lock = (oflags & O_TRUNC) ? VNODE_WRITE : VNODE_OPCL;
   vp = advance(dirp, &findnode, fp);
   assert(vp_vmp == NULL);      /* Lookup to last dir should have yielded lock