From patchwork Fri Nov 13 23:54:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1400183 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CXwL86LG6z9sSs for ; Sat, 14 Nov 2020 10:54:24 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 197A83954404; Fri, 13 Nov 2020 23:54:22 +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 808B239540F2 for ; Fri, 13 Nov 2020 23:54:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 808B239540F2 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 B9FA0E14; Sat, 14 Nov 2020 00:54:18 +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 EBQdXbtO9oNM; Sat, 14 Nov 2020 00:54:18 +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 43BF3DFD; Sat, 14 Nov 2020 00:54:18 +0100 (CET) Received: from samy by function.youpi.perso.aquilenet.fr with local (Exim 4.94) (envelope-from ) id 1kditV-0083Ye-9G; Sat, 14 Nov 2020 00:54:17 +0100 From: Samuel Thibault To: libc-alpha@sourceware.org Subject: [hurd, commited] hurd: make ptsname fail with ENOTTY on non-master-pty Date: Sat, 14 Nov 2020 00:54:16 +0100 Message-Id: <20201113235416.1920257-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-Spam-Status: No, score=-11.6 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" --- sysdeps/mach/hurd/ptsname.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sysdeps/mach/hurd/ptsname.c b/sysdeps/mach/hurd/ptsname.c index 065ba2a268..2bcbe7b03f 100644 --- a/sysdeps/mach/hurd/ptsname.c +++ b/sysdeps/mach/hurd/ptsname.c @@ -46,6 +46,14 @@ __ptsname_internal (int fd, char *buf, size_t buflen, struct stat64 *stp) string_t peername; size_t len; error_t err; + int ttype; + + if (HURD_DPORT_USE (fd, __term_get_bottom_type (port, &ttype)) == 0) + { + /* get_bottom_type suceeded, this is the slave side. */ + errno = ENOTTY; + return ENOTTY; + } if (err = HURD_DPORT_USE (fd, __term_get_peername (port, peername))) {