From 3979d8f45784ccf80cebbb5007da054a87ded2c9 Mon Sep 17 00:00:00 2001
From: Eli Zaretskii <eliz@gnu.org>
Date: Fri, 27 Jan 2017 21:58:10 +0200
Subject: [PATCH] Restore a test that was removed by a recent commit

* src/fileio.c (Ffile_accessible_directory_p): Don't overwrite the
errno value unless it's necessary.  (Bug#25419)
---
 src/fileio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/fileio.c b/src/fileio.c
index b8706e1e893..81eaa771189 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2823,7 +2823,8 @@ really is a readable and searchable directory.  */)
 	 avoids reporting "Success" for a failed operation.  Perhaps
 	 someday we can fix this in a better way, by improving
 	 file-accessible-directory-p's API; see Bug#25419.  */
-      errno = EACCES;
+      if (!EQ (r, Qt))
+	errno = EACCES;
 
       return r;
     }
-- 
2.39.5