From patchwork Fri Jan 13 17:52:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 715183 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3v0VbN5s9pz9t2D for ; Sat, 14 Jan 2017 04:52:59 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="k5LxI9Y+"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=niyVvsxwZUVALcgPFDL1nSJjYyEztYife25HCVM2znoKFLh83NYaX t56gf78OzfooFoOi+3LIN8ENyBlzxLNt/h9f37hOBk8EKk1OZeUbNYDL4xTE7aNi 8rtvdvNuT0/IdVfdhCOIjev1umspSN+4PYiyhlEbSzNnTl9tbN2LuU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=nyqnotAULU+wEsW7IQYgOywvDdQ=; b=k5LxI9Y+fQNyuUWylIaK gPxZa4Qx0pUnzZIprfhCLrSZpQbJ33NfIGfNTcb+3n6TqkjaXG4W9EgVT5eXj3hG uo7JbkDgb7tC9YGvttH040I4qWjAxaRm8+vic9tkYbRciy/+cRmLsgeDw/D3xVUv s96dZ+DPmlMVmq5uQB0UAkM= Received: (qmail 81805 invoked by alias); 13 Jan 2017 17:52:43 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 81786 invoked by uid 89); 13 Jan 2017 17:52:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.1 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 13 Jan 2017 17:52:33 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DFC534E048; Fri, 13 Jan 2017 17:52:32 +0000 (UTC) Received: from localhost (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v0DHqVXh025842; Fri, 13 Jan 2017 12:52:32 -0500 Date: Fri, 13 Jan 2017 17:52:30 +0000 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] PR65411 don't retry fclose on EINTR Message-ID: <20170113175230.GA13479@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.7.1 (2016-10-04) After an interrupted fclose() we can't know if it's safe (or undefined behaviour) to re-use the FILE*, so we shouldn't try calling fclose again. PR libstdc++/65411 * config/io/basic_file_stdio.cc (__basic_file::close()): Don't retry fclose on EINTR. Tested x86_64-linux, committed to trunk. commit 852ab4a7f7619036ddf2d7263a40368c351ff19c Author: Jonathan Wakely Date: Fri Jan 13 17:25:06 2017 +0000 PR65411 don't retry fclose on EINTR PR libstdc++/65411 * config/io/basic_file_stdio.cc (__basic_file::close()): Don't retry fclose on EINTR. diff --git a/libstdc++-v3/config/io/basic_file_stdio.cc b/libstdc++-v3/config/io/basic_file_stdio.cc index a0ad82c..e736701 100644 --- a/libstdc++-v3/config/io/basic_file_stdio.cc +++ b/libstdc++-v3/config/io/basic_file_stdio.cc @@ -267,16 +267,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { int __err = 0; if (_M_cfile_created) - { - // In general, no need to zero errno in advance if checking - // for error first. However, C89/C99 (at variance with IEEE - // 1003.1, f.i.) do not mandate that fclose must set errno - // upon error. - errno = 0; - do - __err = fclose(_M_cfile); - while (__err && errno == EINTR); - } + __err = fclose(_M_cfile); _M_cfile = 0; if (!__err) __ret = this;