From: David van Moolenbroek Date: Wed, 20 May 2009 09:46:06 +0000 (+0000) Subject: move symlink type check for readlink() into VFS, and return the right POSIX error X-Git-Tag: v3.1.4~22 X-Git-Url: http://zhaoyanbai.com/repos/readme1st.txt?a=commitdiff_plain;h=9797d17d5460d5816c9f78099ebc09df88247d1b;p=minix.git move symlink type check for readlink() into VFS, and return the right POSIX error --- diff --git a/servers/vfs/link.c b/servers/vfs/link.c index e2fb29610..fd342593d 100644 --- a/servers/vfs/link.c +++ b/servers/vfs/link.c @@ -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);