From patchwork Thu Aug 15 21:18:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 1147847 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-104502-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="MYCn8P4s"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="JmPdFYcc"; 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 468fTQ2D54z9s3Z for ; Fri, 16 Aug 2019 07:19:06 +1000 (AEST) 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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=Dx6ATECnJnuEgBuS7If1y5j7evf7Wyk 6+2LzaExgrISzeLTa3pFymTwSTYSS7n948I6WEWQ4MfkQU07Sg/ZDovwHRSdbJk2 tonrubUumtqjhq18Jpg9j8sKP7Udxpr6qvyR+4xpp44DWkYT6Tb1rFn2c7x1kAHQ kQ9zr+ppK86o= 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:subject:date:message-id:in-reply-to :references; s=default; bh=8wqizd9stadwfeMIy8HoBA8hG7U=; b=MYCn8 P4sCyTepboWe5VISrtabl6Etn1qrgOxYGVH3STf6ki9goQ7+P63/8KPXFpDi/k+n oin+2SdiP89f24tJ0DAufDBxA+upGDWrNx1CKbmzCSP9sfzTwUuPelcaK5sTjhht jSkaWecXjR14UdpzCR4iZJ33L62SplTGf9NS2c= Received: (qmail 51822 invoked by alias); 15 Aug 2019 21:18:53 -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 51747 invoked by uid 89); 15 Aug 2019 21:18:52 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=H*RU:209.85.160.195, HX-Spam-Relays-External:209.85.160.195, HX-Languages-Length:947 X-HELO: mail-qt1-f195.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=USb0e92xrMdwjFjt4UMhe9YbsXTiBYfRmilHa6bkkiM=; b=JmPdFYcc+ARTx07ZcddU7huY21vzaI5reyJbNVNB8ZlpkgepVYE/VY0m4OAmjNcDeC 5Vhij1X2i9BkaSXZnBzpSWCTIhxib/sgtx/XBOPlmJhckKM5tJgJay05VaL6TBuPP7iy Sw1eL7y2T8vdY+AeYqJ3ZzEdOf4HG/dUJZlBDkeMhHvFNWdRSo8oZ+E+ySZfC8kUvv6+ RJigGy+Gfec2hzX4NDiAo9uVB5GnkQi8DxK/GRNZ2+IC0sXIW2r4WNSGUZZOEqr+LuLv D6q9WbpVxfRXiW6STQkc2IPpjSVgGAPpvynNK3SSOXjxaH52Z1GxWy9z7DNGckNlKbGZ LB4g== From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 2/4] nptl: Handle EPIPE on tst-cancel2 Date: Thu, 15 Aug 2019 18:18:41 -0300 Message-Id: <20190815211843.22799-2-adhemerval.zanella@linaro.org> In-Reply-To: <20190815211843.22799-1-adhemerval.zanella@linaro.org> References: <20190815211843.22799-1-adhemerval.zanella@linaro.org> The SIGPIPE can be handled before SIGCANCEL, which makes write fail and the thread return a non expected result. Checked on x86_64-linux-gnu. * nptl/tst-cancel2.c (tf): Do not abort with EPIPE. --- nptl/tst-cancel2.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/nptl/tst-cancel2.c b/nptl/tst-cancel2.c index 1f0429d343..632ea4e0ae 100644 --- a/nptl/tst-cancel2.c +++ b/nptl/tst-cancel2.c @@ -20,6 +20,7 @@ #include #include #include +#include static int fd[2]; @@ -32,7 +33,14 @@ tf (void *arg) write blocks. */ char buf[100000]; - while (write (fd[1], buf, sizeof (buf)) > 0); + while (1) + { + /* Ignore EPIPE errors for case the SIGPIPE is handle before + SIGCANCEL. */ + ssize_t ret = write (fd[1], buf, sizeof (buf)); + if (ret == 0 || (ret == -1 && errno != EPIPE)) + break; + } return (void *) 42l; }