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
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>
10 (cherry picked from commit eb880e93ed4a48c67ac27b4d5194f0f7786da83e)
12 proxy/src/gp_config.c | 24 ++++++++++++++----------
13 1 file changed, 14 insertions(+), 10 deletions(-)
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,
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));
30 - ref_array_destroy(error_list);
32 - GPDEBUG("Error when reading config directory number: %d\n", ret);
36 + GPAUDIT("Error when reading config directory number: %d\n", ret);
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));
47 + ref_array_destroy(error_list);