From: Eli Zaretskii Date: Fri, 27 Jan 2017 08:51:53 +0000 (+0200) Subject: Don't report zero errno for inaccessible directory X-Git-Tag: emacs-26.0.90~870^2~19 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=525a6d2c4fcd4a319e196ede0513275f6b07eb2c;p=emacs.git 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) --- diff --git a/src/fileio.c b/src/fileio.c index ac6d7819411..8e549a44855 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; }