From 162db89eff70660963f416e862f62fa35d718593 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 5 Jan 2019 14:46:51 +0100 Subject: hurd: fix error on opening symlink with O_NOFOLLOW|O_WRITE POSIX requires ELOOP in that case. * libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): Return ELOOP instead of EACCES when the result is a symlink and O_WRITE|O_EXEC was requested --- libdiskfs/dir-lookup.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libdiskfs/dir-lookup.c') diff --git a/libdiskfs/dir-lookup.c b/libdiskfs/dir-lookup.c index eafeefc3..05e3fc5b 100644 --- a/libdiskfs/dir-lookup.c +++ b/libdiskfs/dir-lookup.c @@ -460,12 +460,14 @@ diskfs_S_dir_lookup (struct protid *dircred, if (!newnode) /* Check permissions on existing nodes, but not new ones. */ { - if (((type == S_IFSOCK || type == S_IFBLK || type == S_IFCHR || + if ((type == S_IFSOCK || type == S_IFBLK || type == S_IFCHR || type == S_IFIFO) && (flags & (O_READ|O_WRITE|O_EXEC))) - || (type == S_IFLNK && (flags & (O_WRITE|O_EXEC)))) err = EACCES; + if (!err && type == S_IFLNK && (flags & (O_WRITE|O_EXEC))) + err = ELOOP; + if (!err && (flags & O_READ)) err = fshelp_access (&np->dn_stat, S_IREAD, dircred->user); -- cgit v1.2.3