From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 6FB47139082 for ; Mon, 27 Nov 2017 07:56:03 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B825FE0AC9; Mon, 27 Nov 2017 07:56:02 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 96AF2E0AC9 for ; Mon, 27 Nov 2017 07:56:02 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5D30833D4A6 for ; Mon, 27 Nov 2017 07:56:01 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A53D89089 for ; Mon, 27 Nov 2017 07:55:59 +0000 (UTC) From: "Robin H. Johnson" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" Message-ID: <1511769067.237d1b34166fea2e4cb0eb28098a5b2759548b86.robbat2@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: main.c X-VCS-Directories: / X-VCS-Committer: robbat2 X-VCS-Committer-Name: Robin H. Johnson X-VCS-Revision: 237d1b34166fea2e4cb0eb28098a5b2759548b86 X-VCS-Branch: master Date: Mon, 27 Nov 2017 07:55:59 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 08accae0-7582-4422-a358-b89c33e07014 X-Archives-Hash: de0d4c0b2aed55f1353fc8cd8d36752a commit: 237d1b34166fea2e4cb0eb28098a5b2759548b86 Author: Robin H. Johnson gentoo org> AuthorDate: Mon Nov 27 07:50:58 2017 +0000 Commit: Robin H. Johnson gentoo org> CommitDate: Mon Nov 27 07:51:07 2017 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=237d1b34 Fix PORTAGE_QUIET quiet result. Having PORTAGE_QUIET set caused the quiet variable to be incremented, but it did not also setup the warnout variable. Add a common setup function for warnout quiet, and use consistently. Signed-off-by: Robin H. Johnson gentoo.org> main.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index d124695..dea03a8 100644 --- a/main.c +++ b/main.c @@ -78,6 +78,15 @@ no_colors(void) setenv("NOCOLOR", "true", 1); } +static void +setup_quiet(void) +{ + /* "e" for FD_CLOEXEC */ + if (quiet == 0) + warnout = fopen("/dev/null", "we"); + ++quiet; +} + /* include common applet defs */ #include "applets.h" @@ -102,7 +111,7 @@ no_colors(void) #define COMMON_GETOPTS_CASES(applet) \ case 0x1: portroot = optarg; break; \ case 'v': ++verbose; break; \ - case 'q': if (quiet == 0) { warnout = fopen("/dev/null", "we"); } ++quiet; break; \ + case 'q': setup_quiet(); break; \ case 'V': version_barf(); break; \ case 'h': applet ## _usage(EXIT_SUCCESS); break; \ case 'C': no_colors(); break; \ @@ -952,7 +961,7 @@ initialize_portage_env(void) xarraypush_str(overlays, main_overlay); if (getenv("PORTAGE_QUIET") != NULL) - quiet = 1; + setup_quiet(); if (nocolor) no_colors();