]> Zhao Yanbai Git Server - minix.git/commitdiff
move symlink type check for readlink() into VFS, and return the right POSIX error
authorDavid van Moolenbroek <david@minix3.org>
Wed, 20 May 2009 09:46:06 +0000 (09:46 +0000)
committerDavid van Moolenbroek <david@minix3.org>
Wed, 20 May 2009 09:46:06 +0000 (09:46 +0000)
servers/vfs/link.c

index e2fb2961087ea3e071d76c54b21a95195d52d746..fd342593d68408f8ac25668b91f2e5847c8b66db 100644 (file)
@@ -356,6 +356,13 @@ PUBLIC int do_rdlink()
   r = lookup_vp(PATH_RET_SYMLINK, 0 /*!use_realuid*/, &vp);
   if (r != OK) return r;
 
+  /* Make sure this is a symbolic link */
+  if ((vp->v_mode & I_TYPE) != I_SYMBOLIC_LINK) {
+       put_vnode(vp);
+
+       return EINVAL;
+  }
+
   /* Issue request */
   r= req_rdlink(vp->v_fs_e, vp->v_inode_nr, who_e, (vir_bytes)m_in.name2,
        copylen);