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 Netto X-Patchwork-Id: 34132 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== Return-Path: 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; }