From patchwork Sun Nov 8 14:11:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 40964 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F0B9E386197D; Sun, 8 Nov 2020 14:11:25 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from hera.aquilenet.fr (hera.aquilenet.fr [IPv6:2a0c:e300::1]) by sourceware.org (Postfix) with ESMTPS id C11A8385700E for ; Sun, 8 Nov 2020 14:11:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C11A8385700E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=samuel.thibault@ens-lyon.org Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id C6DFBD08; Sun, 8 Nov 2020 15:11:21 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4uhnDIbS5v6P; Sun, 8 Nov 2020 15:11:21 +0100 (CET) Received: from function.youpi.perso.aquilenet.fr (lfbn-bor-1-56-204.w90-50.abo.wanadoo.fr [90.50.148.204]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 3AC6FB1F; Sun, 8 Nov 2020 15:11:21 +0100 (CET) Received: from samy by function.youpi.perso.aquilenet.fr with local (Exim 4.94) (envelope-from ) id 1kblPc-009LJj-JQ; Sun, 08 Nov 2020 15:11:20 +0100 From: Samuel Thibault To: libc-alpha@sourceware.org Subject: [hurd, commited] bsd unlockpt: unlockpt needs to fail with EINVAL, not ENOTTY Date: Sun, 8 Nov 2020 15:11:19 +0100 Message-Id: <20201108141119.2226854-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_NEUTRAL, 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: , Cc: commit-hurd@gnu.org Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The EINVAL error code is mandated by POSIX, while ptsname_r returns ENOTTY, so we need to translate. --- sysdeps/unix/bsd/unlockpt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sysdeps/unix/bsd/unlockpt.c b/sysdeps/unix/bsd/unlockpt.c index d8b7f0cae7..e609685c2f 100644 --- a/sysdeps/unix/bsd/unlockpt.c +++ b/sysdeps/unix/bsd/unlockpt.c @@ -20,6 +20,7 @@ #include #include #include +#include /* Unlock the slave pseudo terminal associated with the master pseudo @@ -31,6 +32,10 @@ unlockpt (int fd) /* BSD doesn't have a lock, but it does have `revoke'. */ if (__ptsname_r (fd, buf, sizeof (buf))) - return -1; + { + if (errno == ENOTTY) + __set_errno (EINVAL); + return -1; + } return __revoke (buf); }