emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 5c41444: Work around macOS faccessat bug


From: Paul Eggert
Subject: [Emacs-diffs] master 5c41444: Work around macOS faccessat bug
Date: Mon, 5 Feb 2018 19:28:47 -0500 (EST)

branch: master
commit 5c414441ed73f1a302a2953dc493e83b98589262
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Work around macOS faccessat bug
    
    * src/fileio.c (file_accessible_directory_p): Append an
    extra "/" to work around macOS bug in faccessat (Bug#30350).
---
 src/fileio.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/fileio.c b/src/fileio.c
index be29e60..b0ef3d4 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2811,12 +2811,15 @@ file_accessible_directory_p (Lisp_Object file)
     dir = data;
   else
     {
-      /* Just check for trailing '/' when deciding whether to append '/'.
-        That's simpler than testing the two special cases "/" and "//",
-        and it's a safe optimization here.  */
-      char *buf = SAFE_ALLOCA (len + 3);
+      /* Just check for trailing '/' when deciding whether append '/'
+        before appending '.'.  That's simpler than testing the two
+        special cases "/" and "//", and it's a safe optimization
+        here.  After appending '.', append another '/' to work around
+        a macOS bug (Bug#30350).  */
+      static char const appended[] = "/./";
+      char *buf = SAFE_ALLOCA (len + sizeof appended);
       memcpy (buf, data, len);
-      strcpy (buf + len, &"/."[data[len - 1] == '/']);
+      strcpy (buf + len, &appended[data[len - 1] == '/']);
       dir = buf;
     }
 



reply via email to

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