You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.8 KiB

From 8603c619ca9bc923534d83ee432ddd756f285d4c Mon Sep 17 00:00:00 2001
From: Alexander Scheel <ascheel@redhat.com>
Date: Wed, 12 Jul 2017 09:26:52 -0400
Subject: [PATCH] Fix error handling in gp_config_from_dir
Signed-off-by: Alexander Scheel <ascheel@redhat.com>
[rharwood@redhat.com: c99, refactor some existing code]
Reviewed-by: Robbie Harwood <rharwood@redhat.com>
Merges: #204
(cherry picked from commit eb880e93ed4a48c67ac27b4d5194f0f7786da83e)
---
proxy/src/gp_config.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/proxy/src/gp_config.c b/proxy/src/gp_config.c
index 8fd60a3..07f7c8d 100644
--- a/proxy/src/gp_config.c
+++ b/proxy/src/gp_config.c
@@ -798,17 +798,21 @@ static int gp_config_from_dir(const char *config_dir,
&error_list,
NULL);
if (ret) {
- if (error_list) {
- uint32_t i;
- uint32_t len = ref_array_getlen(error_list, &i);
- for (i = 0; i < len; i++) {
- GPDEBUG("Error when reading config directory: %s\n",
- (const char *) ref_array_get(error_list, i, NULL));
- }
- ref_array_destroy(error_list);
- } else {
- GPDEBUG("Error when reading config directory number: %d\n", ret);
+ uint32_t len;
+
+ if (!error_list) {
+ GPAUDIT("Error when reading config directory number: %d\n", ret);
+ return ret;
}
+
+ len = ref_array_len(error_list);
+ for (uint32_t i = 0; i < len; i++) {
+ /* libini has an unfixable bug where error strings are (char **) */
+ GPAUDIT("Error when reading config directory: %s\n",
+ *(char **)ref_array_get(error_list, i, NULL));
+ }
+
+ ref_array_destroy(error_list);
return ret;
}