chiark / gitweb /
Import gnupg2_2.1.18-8~deb9u1.debian.tar.bz2
[gnupg2.git] / patches / 0036-gpgconf-No-ENOENT-warning-with-change-options-et-al.patch
1 From: Werner Koch <wk@gnupg.org>
2 Date: Mon, 13 Feb 2017 19:38:53 +0100
3 Subject: gpgconf: No ENOENT warning with --change-options et al.
4
5 * tools/gpgconf-comp.c (retrieve_options_from_program): Check ERRNO
6 before printing a warning.
7 --
8
9 It is common that a conf files does not exist - thus we should not
10 print a warning.
11
12 GnuPG-bug-id: 2944
13
14 BTW: The error messages in gpgconf should be reworked to match those
15 of the other components.
16
17 Signed-off-by: Werner Koch <wk@gnupg.org>
18 (cherry picked from commit 30dac0486b6357e84fbe79c612eea940b654e4d1)
19 ---
20  tools/gpgconf-comp.c | 7 +++++--
21  1 file changed, 5 insertions(+), 2 deletions(-)
22
23 diff --git a/tools/gpgconf-comp.c b/tools/gpgconf-comp.c
24 index 180fd65..a0d9659 100644
25 --- a/tools/gpgconf-comp.c
26 +++ b/tools/gpgconf-comp.c
27 @@ -2163,8 +2163,11 @@ retrieve_options_from_program (gc_component_t component, gc_backend_t backend)
28  
29    config = es_fopen (config_filename, "r");
30    if (!config)
31 -    gc_error (0, errno, "warning: can not open config file %s",
32 -             config_filename);
33 +    {
34 +      if (errno != ENOENT)
35 +        gc_error (0, errno, "warning: can not open config file %s",
36 +                  config_filename);
37 +    }
38    else
39      {
40        while ((length = es_read_line (config, &line, &line_len, NULL)) > 0)