diff options
| -rw-r--r-- | src/sysdep.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/sysdep.c b/src/sysdep.c index 26d381f5796..8291a606bea 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -232,7 +232,18 @@ emacs_get_current_dir_name (void) | |||
| 232 | bool use_libc = true; | 232 | bool use_libc = true; |
| 233 | # endif | 233 | # endif |
| 234 | if (use_libc) | 234 | if (use_libc) |
| 235 | return get_current_dir_name (); | 235 | { |
| 236 | /* GNU/Linux get_current_dir_name can return a string starting | ||
| 237 | with "(unreachable)" (Bug#27871). */ | ||
| 238 | char *wd = get_current_dir_name (); | ||
| 239 | if (wd && ! (IS_DIRECTORY_SEP (*wd) || (*wd && IS_DEVICE_SEP (wd[1])))) | ||
| 240 | { | ||
| 241 | free (wd); | ||
| 242 | errno = ENOENT; | ||
| 243 | return NULL; | ||
| 244 | } | ||
| 245 | return wd; | ||
| 246 | } | ||
| 236 | # endif | 247 | # endif |
| 237 | 248 | ||
| 238 | char *buf; | 249 | char *buf; |