emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-26 db893ab: Fix bug with unmounted directory on GNU/


From: Paul Eggert
Subject: [Emacs-diffs] emacs-26 db893ab: Fix bug with unmounted directory on GNU/Linux
Date: Thu, 5 Oct 2017 19:05:55 -0400 (EDT)

branch: emacs-26
commit db893ab863770ef3f89102d6837cd3eb021429ba
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    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).
---
 src/sysdep.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/sysdep.c b/src/sysdep.c
index 26d381f..8291a60 100644
--- a/src/sysdep.c
+++ b/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;



reply via email to

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