unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [hurd,commited] hurd getcwd: Allow unknown root directory
@ 2019-08-29 23:08 Samuel Thibault
  0 siblings, 0 replies; only message in thread
From: Samuel Thibault @ 2019-08-29 23:08 UTC (permalink / raw)
  To: libc-alpha; +Cc: Samuel Thibault, commit-hurd

To be efficient, the remap translator simply returns ports from the underlying
filesystem, and thus the root directory found through browsing '..' is the
underlying root, not the remap root. This should not be a reason for getcwd to
fail.

* sysdeps/mach/hurd/getcwd.c (_hurd_canonicalize_directory_name_internal): Do
not remove the heading slash if we got an unknown root directory.
(__getcwd): Do not fail with EGRATUITOUS if we got an unknown root directory.
---
 ChangeLog                  | 10 +++++++++-
 sysdeps/mach/hurd/getcwd.c | 12 ------------
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c3cae2a11e..d2ec5d5ac0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,12 @@
-2019-08-30  Richard Braun <rbraun@sceen.net>
+2019-08-30  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+
+	* sysdeps/mach/hurd/getcwd.c
+	(_hurd_canonicalize_directory_name_internal): Do not remove the heading
+	slash if we got an unknown root directory. (__getcwd): Do not fail with
+	EGRATUITOUS if we got an unknown root directory.
+
+2019-08-30  Richard Braun  <rbraun@sceen.net>
 
 	* hurd/hurdselect.c (_hurd_select): Always call __io_select with no
 	timeout.
diff --git a/sysdeps/mach/hurd/getcwd.c b/sysdeps/mach/hurd/getcwd.c
index 93b7b1de58..7481ae9857 100644
--- a/sysdeps/mach/hurd/getcwd.c
+++ b/sysdeps/mach/hurd/getcwd.c
@@ -266,11 +266,6 @@ __hurd_canonicalize_directory_name_internal (file_t thisdir,
        So the root is our current directory.  */
     *--file_namep = '/';
 
-  if (thisid != rootid)
-    /* We did not get to our root directory. The returned name should
-       not begin with a slash.  */
-    ++file_namep;
-
   memmove (file_name, file_namep, file_name + size - file_namep);
   cleanup ();
   return file_name;
@@ -309,13 +304,6 @@ __getcwd (char *buf, size_t size)
     __USEPORT (CWDIR,
 	       __hurd_canonicalize_directory_name_internal (port,
 							    buf, size));
-  if (cwd && cwd[0] != '/')
-    {
-      /* `cwd' is an unknown root directory.  */
-      if (buf == NULL)
-	  free (cwd);
-      return __hurd_fail (EGRATUITOUS), NULL;
-    }
   return cwd;
 }
 weak_alias (__getcwd, getcwd)
-- 
2.23.0.rc1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-08-29 23:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-29 23:08 [hurd,commited] hurd getcwd: Allow unknown root directory Samuel Thibault

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).