Remove broken code to replace st_mode value with ACCESSPERMS when

lstat(2) is called on symlinks -- this code appears never to have
worked.  The PR this addresses suggests that the intended
original behavior is the right one, but as bde points out in the
PR comments, we do actually support storing a mode on symlinks,
so returning it seems reasonable.

This is consistent with Mac OS X, which despite documentation to
the contrary does return the mode set on a symlink, but not some
other platforms.  The Single Unix Spec requires only that the
returned bits be "meaningful", which seems at best unhelpful as
advice goes.

PR:		25018
MFC after:	3 days
This commit is contained in:
Robert Watson 2008-08-03 15:44:56 +00:00
parent f0fe5e9127
commit 1d986c5ff1

View File

@ -736,11 +736,6 @@ vn_stat(vp, sb, active_cred, file_cred, td)
break;
case VLNK:
mode |= S_IFLNK;
/* This is a cosmetic change, symlinks do not have a mode. */
if (vp->v_mount->mnt_flag & MNT_NOSYMFOLLOW)
sb->st_mode &= ~ACCESSPERMS; /* 0000 */
else
sb->st_mode |= ACCESSPERMS; /* 0777 */
break;
case VSOCK:
mode |= S_IFSOCK;