From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.cs.ucla.edu (mail.cs.ucla.edu [131.179.128.66]) by sourceware.org (Postfix) with ESMTPS id 331A03858D20 for ; Fri, 1 Sep 2023 17:57:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 331A03858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=cs.ucla.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cs.ucla.edu Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id A4ACF3C011BDF; Fri, 1 Sep 2023 10:57:03 -0700 (PDT) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id evjFfQvBqk0p; Fri, 1 Sep 2023 10:57:03 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 5F3EE3C011BE3; Fri, 1 Sep 2023 10:57:03 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 5F3EE3C011BE3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1693591023; bh=MiMpZFiq7dQKZ24va48fc1dz58AA0WjjCY+i/PTKnH4=; h=Message-ID:Date:MIME-Version:To:From; b=qxBT+/G7yms9Kjzzmc0N+3Q84d1iEMMxGypUv3ipmm1H6PaSADhVlx+Ih1z7CIHOe v5PDWXdkaBRQNFUWCOs9AwvBRsQgjQMMlQlXA58gzHq6T9BFwBKGovDuwweSjRKuz2 /rBvh91/uhJXgfDvG7taVsyjLD84Urg8XEv3KxIEG7v0PpAUXf1fmiDrLSxNI0+l/q 4ybGca0RicnOZkxSQa/yirbosf+WfAWoLKy7oAweO73E/g7eib1qHNqFTSQjCEA5xA rkeLblTTEFMCbujTohbqnx4bT1ucYtYSoKKnjeF2usu38cvKbf0axZd4wR9HFKNOUR inQgJfoJQWxwg== X-Virus-Scanned: amavisd-new at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id RIVcoYISYc9F; Fri, 1 Sep 2023 10:57:03 -0700 (PDT) Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 385193C011BDF; Fri, 1 Sep 2023 10:57:03 -0700 (PDT) Message-ID: Date: Fri, 1 Sep 2023 10:57:03 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v2] linux: Make fdopendir fail with O_PATH (BZ 30373) Content-Language: en-US To: Adhemerval Zanella , libc-alpha@sourceware.org References: <20230901122651.59253-1-adhemerval.zanella@linaro.org> From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: <20230901122651.59253-1-adhemerval.zanella@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2023-09-01 05:26, Adhemerval Zanella wrote: > + /* Fail early for descriptors opened with O_PATH. */ > + if (__glibc_unlikely (flags & O_PATH)) > + { > + __set_errno (EBADF); > + return NULL; > + } > + /* Make sure the descriptor allows for reading. */ > if (__glibc_unlikely ((flags & O_ACCMODE) == O_WRONLY)) > { > __set_errno (EINVAL); Why use EBADF for one situation but EINVAL in the other? POSIX says it should be EBADF for both situations. Arguably this is a separate bug, but we should fix both bugs (and fix the documentation too, to match POSIX).