unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: libc-alpha@sourceware.org
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>, commit-hurd@gnu.org
Subject: [hurd,commited] hurd: Support AT_EMPTY_PATH
Date: Tue, 22 Jan 2019 23:41:58 +0100	[thread overview]
Message-ID: <20190122224158.30922-1-samuel.thibault@ens-lyon.org> (raw)

	* hurd/lookup-at.c (__file_name_lookup_at): When at_flags contains
	AT_EMPTY_PATH, call __dir_lookup and __hurd_file_name_lookup_retry
	directly instead of __hurd_file_name_lookup.
---
 ChangeLog        |  3 +++
 hurd/lookup-at.c | 20 ++++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 8bffe5035b..fed239cf3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,9 @@
 
 	* sysdeps/mach/hurd/faccessat.c (__faccessat_common): Check for errors
 	returned by __hurd_at_flags.
+	* hurd/lookup-at.c (__file_name_lookup_at): When at_flags contains
+	AT_EMPTY_PATH, call __dir_lookup and __hurd_file_name_lookup_retry
+	directly instead of __hurd_file_name_lookup.
 
 2019-01-21  Joseph Myers  <joseph@codesourcery.com>
 
diff --git a/hurd/lookup-at.c b/hurd/lookup-at.c
index 813ebee8e5..3e6980f949 100644
--- a/hurd/lookup-at.c
+++ b/hurd/lookup-at.c
@@ -28,6 +28,9 @@ __file_name_lookup_at (int fd, int at_flags,
 {
   error_t err;
   file_t result;
+  int empty = at_flags & AT_EMPTY_PATH;
+
+  at_flags &= ~AT_EMPTY_PATH;
 
   err = __hurd_at_flags (&at_flags, &flags);
   if (err)
@@ -36,6 +39,23 @@ __file_name_lookup_at (int fd, int at_flags,
   if (fd == AT_FDCWD || file_name[0] == '/')
     return __file_name_lookup (file_name, flags, mode);
 
+  if (empty != 0 && file_name[0] == '\0')
+    {
+      enum retry_type doretry;
+      char retryname[1024];	/* XXX string_t LOSES! */
+
+      err = HURD_DPORT_USE (fd, __dir_lookup (port, "", flags, mode,
+					      &doretry, retryname,
+					      &result));
+
+      if (! err)
+	err = __hurd_file_name_lookup_retry (&_hurd_ports_use, &__getdport,
+					     NULL, doretry, retryname,
+					     flags, mode, &result);
+
+      return err ? (__hurd_dfail (fd, err), MACH_PORT_NULL) : result;
+    }
+
   file_t startdir;
   error_t use_init_port (int which, error_t (*operate) (mach_port_t))
     {
-- 
2.20.1


                 reply	other threads:[~2019-01-22 22:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190122224158.30922-1-samuel.thibault@ens-lyon.org \
    --to=samuel.thibault@ens-lyon.org \
    --cc=commit-hurd@gnu.org \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).