Rebased diff after bluhm's conflicting realpath/POSIX fix.
Index: kern/vfs_lookup.c
===================================================================
RCS file: /cvs/src/sys/kern/vfs_lookup.c,v
retrieving revision 1.79
diff -u -p -r1.79 vfs_lookup.c
--- kern/vfs_lookup.c 15 Jul 2019 14:56:45 -0000 1.79
+++ kern/vfs_lookup.c 16 Jul 2019 12:34:36 -0000
@@ -577,10 +577,11 @@ dirloop:
printf("not found\n");
#endif
/*
- * Allow for unveiling a file in a directory where we
- * don't have access to create it ourselves
+ * Allow for unveiling a file in a directory which we cannot
+ * create outselves.
*/
- if (ndp->ni_pledge == PLEDGE_UNVEIL && error == EACCES)
+ if (ndp->ni_pledge == PLEDGE_UNVEIL &&
+ (error == EACCES || error == EROFS))
error = EJUSTRETURN;
if (error != EJUSTRETURN)