Fix bug with unmounted directory on GNU/Linux
* src/sysdep.c (emacs_get_current_dir_name): Do not use get_current_dir_name result unless it is absolute (Bug#27871).
This commit is contained in:
parent
16dc580aa6
commit
db893ab863
1 changed files with 12 additions and 1 deletions
13
src/sysdep.c
13
src/sysdep.c
|
@ -232,7 +232,18 @@ emacs_get_current_dir_name (void)
|
|||
bool use_libc = true;
|
||||
# endif
|
||||
if (use_libc)
|
||||
return get_current_dir_name ();
|
||||
{
|
||||
/* GNU/Linux get_current_dir_name can return a string starting
|
||||
with "(unreachable)" (Bug#27871). */
|
||||
char *wd = get_current_dir_name ();
|
||||
if (wd && ! (IS_DIRECTORY_SEP (*wd) || (*wd && IS_DEVICE_SEP (wd[1]))))
|
||||
{
|
||||
free (wd);
|
||||
errno = ENOENT;
|
||||
return NULL;
|
||||
}
|
||||
return wd;
|
||||
}
|
||||
# endif
|
||||
|
||||
char *buf;
|
||||
|
|
Loading…
Add table
Reference in a new issue