Gentoo Archives: gentoo-commits

From: "Robin H. Johnson" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage-utils:master commit in: /
Date: Mon, 27 Nov 2017 07:56:03
Message-Id: 1511769067.237d1b34166fea2e4cb0eb28098a5b2759548b86.robbat2@gentoo
1 commit: 237d1b34166fea2e4cb0eb28098a5b2759548b86
2 Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
3 AuthorDate: Mon Nov 27 07:50:58 2017 +0000
4 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
5 CommitDate: Mon Nov 27 07:51:07 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=237d1b34
7
8 Fix PORTAGE_QUIET quiet result.
9
10 Having PORTAGE_QUIET set caused the quiet variable to be incremented,
11 but it did not also setup the warnout variable.
12
13 Add a common setup function for warnout quiet, and use consistently.
14
15 Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
16
17 main.c | 13 +++++++++++--
18 1 file changed, 11 insertions(+), 2 deletions(-)
19
20 diff --git a/main.c b/main.c
21 index d124695..dea03a8 100644
22 --- a/main.c
23 +++ b/main.c
24 @@ -78,6 +78,15 @@ no_colors(void)
25 setenv("NOCOLOR", "true", 1);
26 }
27
28 +static void
29 +setup_quiet(void)
30 +{
31 + /* "e" for FD_CLOEXEC */
32 + if (quiet == 0)
33 + warnout = fopen("/dev/null", "we");
34 + ++quiet;
35 +}
36 +
37 /* include common applet defs */
38 #include "applets.h"
39
40 @@ -102,7 +111,7 @@ no_colors(void)
41 #define COMMON_GETOPTS_CASES(applet) \
42 case 0x1: portroot = optarg; break; \
43 case 'v': ++verbose; break; \
44 - case 'q': if (quiet == 0) { warnout = fopen("/dev/null", "we"); } ++quiet; break; \
45 + case 'q': setup_quiet(); break; \
46 case 'V': version_barf(); break; \
47 case 'h': applet ## _usage(EXIT_SUCCESS); break; \
48 case 'C': no_colors(); break; \
49 @@ -952,7 +961,7 @@ initialize_portage_env(void)
50 xarraypush_str(overlays, main_overlay);
51
52 if (getenv("PORTAGE_QUIET") != NULL)
53 - quiet = 1;
54 + setup_quiet();
55
56 if (nocolor)
57 no_colors();