From owner-svn-src-stable@FreeBSD.ORG Thu Apr 30 18:11:44 2015 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 36732B0A; Thu, 30 Apr 2015 18:11:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 247CB1A66; Thu, 30 Apr 2015 18:11:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3UIBins066006; Thu, 30 Apr 2015 18:11:44 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3UIBhQE066005; Thu, 30 Apr 2015 18:11:44 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201504301811.t3UIBhQE066005@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Thu, 30 Apr 2015 18:11:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r282279 - stable/9/usr.bin/wc X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2015 18:11:44 -0000 Author: bdrewery Date: Thu Apr 30 18:11:43 2015 New Revision: 282279 URL: https://svnweb.freebsd.org/changeset/base/282279 Log: MFC r281617: wc: Fix SIGINFO race causing final results to be lost to stderr. Relnotes: yes Modified: stable/9/usr.bin/wc/wc.c Directory Properties: stable/9/usr.bin/wc/ (props changed) Modified: stable/9/usr.bin/wc/wc.c ============================================================================== --- stable/9/usr.bin/wc/wc.c Thu Apr 30 18:07:48 2015 (r282278) +++ stable/9/usr.bin/wc/wc.c Thu Apr 30 18:11:43 2015 (r282279) @@ -74,6 +74,14 @@ siginfo_handler(int sig __unused) siginfo = 1; } +static void +reset_siginfo(void) +{ + + signal(SIGINFO, SIG_DFL); + siginfo = 0; +} + int main(int argc, char *argv[]) { @@ -207,6 +215,7 @@ cnt(const char *file) } else tmpll++; } + reset_siginfo(); tlinect += linect; if (dochar) tcharct += charct; @@ -229,6 +238,7 @@ cnt(const char *file) return (1); } if (S_ISREG(sb.st_mode)) { + reset_siginfo(); charct = sb.st_size; show_cnt(file, linect, wordct, charct, llct); tcharct += charct; @@ -289,6 +299,7 @@ word: gotsp = 1; } } } + reset_siginfo(); if (domulti && MB_CUR_MAX > 1) if (mbrtowc(NULL, NULL, 0, &mbs) == (size_t)-1 && !warned) warn("%s", file != NULL ? file : "stdin");