Revert "Revert "oran-shell-release: release image for F""
[pti/rtp.git] / meta-starlingx / meta-stx-distro / recipes-security / gssproxy / files / Fix-error-handling-in-gp_config_from_dir.patch
1 From 8603c619ca9bc923534d83ee432ddd756f285d4c Mon Sep 17 00:00:00 2001
2 From: Alexander Scheel <ascheel@redhat.com>
3 Date: Wed, 12 Jul 2017 09:26:52 -0400
4 Subject: [PATCH] Fix error handling in gp_config_from_dir
5
6 Signed-off-by: Alexander Scheel <ascheel@redhat.com>
7 [rharwood@redhat.com: c99, refactor some existing code]
8 Reviewed-by: Robbie Harwood <rharwood@redhat.com>
9 Merges: #204
10 (cherry picked from commit eb880e93ed4a48c67ac27b4d5194f0f7786da83e)
11 ---
12  proxy/src/gp_config.c | 24 ++++++++++++++----------
13  1 file changed, 14 insertions(+), 10 deletions(-)
14
15 diff --git a/proxy/src/gp_config.c b/proxy/src/gp_config.c
16 index 8fd60a3..07f7c8d 100644
17 --- a/proxy/src/gp_config.c
18 +++ b/proxy/src/gp_config.c
19 @@ -798,17 +798,21 @@ static int gp_config_from_dir(const char *config_dir,
20                               &error_list,
21                               NULL);
22      if (ret) {
23 -        if (error_list) {
24 -            uint32_t i;
25 -            uint32_t len = ref_array_getlen(error_list, &i);
26 -            for (i = 0; i < len; i++) {
27 -                GPDEBUG("Error when reading config directory: %s\n",
28 -                        (const char *) ref_array_get(error_list, i, NULL));
29 -            }
30 -            ref_array_destroy(error_list);
31 -        } else {
32 -            GPDEBUG("Error when reading config directory number: %d\n", ret);
33 +        uint32_t len;
34 +
35 +        if (!error_list) {
36 +            GPAUDIT("Error when reading config directory number: %d\n", ret);
37 +            return ret;
38          }
39 +
40 +        len = ref_array_len(error_list);
41 +        for (uint32_t i = 0; i < len; i++) {
42 +            /* libini has an unfixable bug where error strings are (char **) */
43 +            GPAUDIT("Error when reading config directory: %s\n",
44 +                    *(char **)ref_array_get(error_list, i, NULL));
45 +        }
46 +
47 +        ref_array_destroy(error_list);
48          return ret;
49      }
50