From patchwork Tue Jan 22 22:41:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1029579 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-99503-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="IWdUGyqz"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43kk1s2P3Pz9s2P for ; Wed, 23 Jan 2019 09:42:08 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; q=dns; s=default; b=MhP pd/0G4gpgGPamyWE3hzAN0tb9u7Y6z2H7kko6uKsrq9VXClWqgA54CJex/vjmzkw FmR3gg3NQ6NoFT38DQCLqT/yyaRYabWEZGPh9zSpjE7F0+gbKbiWV6SFhrAq+3OJ z6myi8h2W9TtiQU+aEVfiRLtu8ZZ83NQWOxZ2wE8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; s=default; bh=lX/vGYVjb voxhsBj13pn75d7bNQ=; b=IWdUGyqzg3Ju40S/D4t4U5CcuHeHV/U2aMRRFWJdl 2O0Q68luCFVdw9JZ2u0TXcbUGoWCOThHpOqHuvVxJqVFd8wmL7tRBgcg7bopijMi MU8bGTEK1LhiWRF3JTrY8xnfVX4olyVMrOssIWKlBDZ2ser+2Ah/vPOGLcMWVNB1 IM= Received: (qmail 16606 invoked by alias); 22 Jan 2019 22:42:03 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 16596 invoked by uid 89); 22 Jan 2019 22:42:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NEUTRAL autolearn=ham version=3.3.2 spammy=HContent-Transfer-Encoding:8bit X-HELO: hera.aquilenet.fr From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd,commited] hurd: Support AT_EMPTY_PATH Date: Tue, 22 Jan 2019 23:41:58 +0100 Message-Id: <20190122224158.30922-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 * 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 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)) {