diff options
| author | Paul Eggert | 2018-02-05 16:27:24 -0800 |
|---|---|---|
| committer | Paul Eggert | 2018-02-05 16:28:41 -0800 |
| commit | 5c414441ed73f1a302a2953dc493e83b98589262 (patch) | |
| tree | 6330ec3d3478fd0c5a6ac094fd0f069cee078fc4 /src | |
| parent | 8e42b1bd3c8ba1757c150149f0d21eabd9245dcc (diff) | |
| download | emacs-5c414441ed73f1a302a2953dc493e83b98589262.tar.gz emacs-5c414441ed73f1a302a2953dc493e83b98589262.zip | |
Work around macOS faccessat bug
* src/fileio.c (file_accessible_directory_p): Append an
extra "/" to work around macOS bug in faccessat (Bug#30350).
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/fileio.c b/src/fileio.c index be29e60fc0a..b0ef3d4e91f 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -2811,12 +2811,15 @@ file_accessible_directory_p (Lisp_Object file) | |||
| 2811 | dir = data; | 2811 | dir = data; |
| 2812 | else | 2812 | else |
| 2813 | { | 2813 | { |
| 2814 | /* Just check for trailing '/' when deciding whether to append '/'. | 2814 | /* Just check for trailing '/' when deciding whether append '/' |
| 2815 | That's simpler than testing the two special cases "/" and "//", | 2815 | before appending '.'. That's simpler than testing the two |
| 2816 | and it's a safe optimization here. */ | 2816 | special cases "/" and "//", and it's a safe optimization |
| 2817 | char *buf = SAFE_ALLOCA (len + 3); | 2817 | here. After appending '.', append another '/' to work around |
| 2818 | a macOS bug (Bug#30350). */ | ||
| 2819 | static char const appended[] = "/./"; | ||
| 2820 | char *buf = SAFE_ALLOCA (len + sizeof appended); | ||
| 2818 | memcpy (buf, data, len); | 2821 | memcpy (buf, data, len); |
| 2819 | strcpy (buf + len, &"/."[data[len - 1] == '/']); | 2822 | strcpy (buf + len, &appended[data[len - 1] == '/']); |
| 2820 | dir = buf; | 2823 | dir = buf; |
| 2821 | } | 2824 | } |
| 2822 | 2825 | ||