X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=meta-stx%2Frecipes-security%2Fgssproxy%2Ffiles%2FFix-error-handling-in-gp_config_from_dir.patch;fp=meta-stx%2Frecipes-security%2Fgssproxy%2Ffiles%2FFix-error-handling-in-gp_config_from_dir.patch;h=a3c43ae485b08335c29b1ed32f69247f5f8b7735;hb=57fdea704bd62af847872c40508f00aa1d7cac60;hp=0000000000000000000000000000000000000000;hpb=f23f21bccfb750b9e30141fd9676515215ffbc4e;p=pti%2Frtp.git diff --git a/meta-stx/recipes-security/gssproxy/files/Fix-error-handling-in-gp_config_from_dir.patch b/meta-stx/recipes-security/gssproxy/files/Fix-error-handling-in-gp_config_from_dir.patch new file mode 100644 index 0000000..a3c43ae --- /dev/null +++ b/meta-stx/recipes-security/gssproxy/files/Fix-error-handling-in-gp_config_from_dir.patch @@ -0,0 +1,50 @@ +From 8603c619ca9bc923534d83ee432ddd756f285d4c Mon Sep 17 00:00:00 2001 +From: Alexander Scheel +Date: Wed, 12 Jul 2017 09:26:52 -0400 +Subject: [PATCH] Fix error handling in gp_config_from_dir + +Signed-off-by: Alexander Scheel +[rharwood@redhat.com: c99, refactor some existing code] +Reviewed-by: Robbie Harwood +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; + } +