about summary refs log tree commit diff
path: root/hurd
diff options
context:
space:
mode:
Diffstat (limited to 'hurd')
-rw-r--r--hurd/hurdlookup.c2
-rw-r--r--hurd/lookup-retry.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/hurd/hurdlookup.c b/hurd/hurdlookup.c
index 1861d5879d..a642c49002 100644
--- a/hurd/hurdlookup.c
+++ b/hurd/hurdlookup.c
@@ -72,7 +72,7 @@ __hurd_file_name_lookup (error_t (*use_init_port)
   if (flags & O_NOFOLLOW)	/* See lookup-retry.c about O_NOFOLLOW.  */
     flags |= O_NOTRANS;
 
-  if (flags & O_DIRECTORY)
+  if (flags & O_DIRECTORY && (flags & O_NOFOLLOW) == 0)
     {
       /* The caller wants to require that the file we look up is a directory.
 	 We can do this without an extra RPC by appending a trailing slash
diff --git a/hurd/lookup-retry.c b/hurd/lookup-retry.c
index 12b5c30962..b596848624 100644
--- a/hurd/lookup-retry.c
+++ b/hurd/lookup-retry.c
@@ -147,6 +147,8 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
 		  err = __io_stat (*result, &st);
 		  if (!err)
 		    {
+		      if (flags & O_DIRECTORY && !S_ISDIR (st.st_mode))
+			err = ENOTDIR;
 		      if (S_ISLNK (st.st_mode))
 			err = ELOOP;
 		      else if (st.st_mode & (S_IPTRANS|S_IATRANS))