From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by sourceware.org (Postfix) with ESMTPS id B8CBA3894431 for ; Fri, 7 May 2021 17:22:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B8CBA3894431 Received: by mail-qk1-x730.google.com with SMTP id l129so9190389qke.8 for ; Fri, 07 May 2021 10:22:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=nak1Gx/3bY4k9/2BSKEGT9A3hfepMcMGhjJOIjFMoUM=; b=h21PXQh8patfuRsJm6MU7z27Dm5T98NxFHBLsrUqlhlREsFBDEa6JJA37EJD2X1zs8 RSyoexMRNACcvJ0fmnE/t1reC4b0jD9smD5uGYFkwFDK43eMp9lPHpRto1vwWw3V6ZHc I6L6vd81ZxRKQC790R7oNm+6aKMic0Is9NKwV3eHikSi4yfiJwiH8xCCsO8E15u6Z2Ck oK0GWeFq+tmPr0txhBNxWuK3pDAgtlMCMbRVyrpyl3+lXko+0xe9MtCpjq4qCXn1/shc BVq07/O6FFKLM2GZsOcTtxxSaZvIu/uZV8F8Uwg03Y8aM9cIPFSCt9BdT96rAgLxG/XK iVTg== X-Gm-Message-State: AOAM530eSq8w5jvrk4DleuKsVQaJQl9HHTuDhFjEOp192Rte/y02d1vJ NR/MoJ+WSvAviBeEzUsA7g/U3g== X-Google-Smtp-Source: ABdhPJzPDYGceUtlhz35Dhqnhr4/v8vsWJ1aLnjNbuf0Iv8CivObPQvBNe46CyHyxzQMhHVyfj9wJg== X-Received: by 2002:a05:620a:133b:: with SMTP id p27mr10607682qkj.354.1620408120234; Fri, 07 May 2021 10:22:00 -0700 (PDT) Received: from [192.168.1.4] ([177.194.37.86]) by smtp.gmail.com with ESMTPSA id c141sm1253045qke.12.2021.05.07.10.21.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 07 May 2021 10:21:59 -0700 (PDT) Subject: Re: [PATCH 3/3] linux: implement ttyname as a wrapper around ttyname_r. From: Adhemerval Zanella To: libc-alpha@sourceware.org, =?UTF-8?Q?=c3=89rico_Nogueira?= References: <20210504015152.31064-1-ericonr@disroot.org> <20210504015152.31064-3-ericonr@disroot.org> <0b9e65b7-832d-ab6f-f73b-1d7ea5fccfe9@linaro.org> Message-ID: <53bc2e47-4845-d762-1a76-c7f1e7437941@linaro.org> Date: Fri, 7 May 2021 14:21:57 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <0b9e65b7-832d-ab6f-f73b-1d7ea5fccfe9@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 17:22:02 -0000 On 04/05/2021 13:43, Adhemerval Zanella wrote: > > > On 04/05/2021 13:37, Adhemerval Zanella wrote: >>> - >>> - if (!name && dostat != -1) >>> + int result = ttyname_r (fd, ttyname_buf, TTYNAME_BUFLEN); >>> + if (result != 0) >> >> Why do you need to pass the allocated buffer size minus 1? The ttyname_r >> should handle it, it already pass buflen - 1 on readlink for instance. > > You also need a libc_hidden_{proto,def} ttyname_r to avoid the intra > PLT (the elf/check-localplt should have warned you about it). > I fixed my previous noted issues along with this one and push it upstream, thanks for the patch.