emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 525a6d2: Don't report zero errno for inaccessible d


From: Eli Zaretskii
Subject: [Emacs-diffs] master 525a6d2: Don't report zero errno for inaccessible directory
Date: Fri, 27 Jan 2017 08:53:22 +0000 (UTC)

branch: master
commit 525a6d2c4fcd4a319e196ede0513275f6b07eb2c
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Don't report zero errno for inaccessible directory
    
    * src/fileio.c (Ffile_accessible_directory_p): Report EACCES when
    a file handler reports a failure.  (Bug#25419)
---
 src/fileio.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/fileio.c b/src/fileio.c
index ac6d781..8e549a4 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2815,7 +2815,14 @@ really is a readable and searchable directory.  */)
   if (!NILP (handler))
     {
       Lisp_Object r = call2 (handler, Qfile_accessible_directory_p, absname);
-      errno = 0;
+
+      /* This might be a lie (e.g., the directory might not exist, or
+        be a regular file), but at least it does TRT in the "usual"
+        case of an existing directory that is not accessible by the
+        current user, and avoids reporting "Success" for a failed
+        operation.  */
+      if (!EQ (r, Qt))
+       errno = EACCES;
       return r;
     }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]