gssproxy/Fix-behavior-when-not-passed-config_dir-on-the-comma.patch

50 lines
1.5 KiB
Diff

From 727e5a91d930750b4cf814f8b37fd4aace303c4c Mon Sep 17 00:00:00 2001
From: Robbie Harwood <rharwood@redhat.com>
Date: Tue, 21 Feb 2017 17:24:48 -0500
Subject: [PATCH] Fix behavior when not passed config_dir on the command line
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
Reviewed-by: Simo Sorce <simo@redhat.com>
(cherry picked from commit 5da58d18668b3e6ce175ad3d4f74a357c31784de)
---
proxy/src/gp_config.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/proxy/src/gp_config.c b/proxy/src/gp_config.c
index cf1c08b..184f59e 100644
--- a/proxy/src/gp_config.c
+++ b/proxy/src/gp_config.c
@@ -612,7 +612,7 @@ struct gp_config *read_config(char *config_file, char *config_dir,
char *socket_name, int opt_daemonize)
{
const char *socket = GP_SOCKET_NAME;
- const char *dir = PUBCONF_PATH;
+ const char *dir = NULL;
struct gp_config *cfg;
int ret;
@@ -634,12 +634,18 @@ struct gp_config *read_config(char *config_file, char *config_dir,
}
}
- if (config_dir) dir = config_dir;
+ if (config_dir) {
+ dir = config_dir;
+ } else if (!config_file) {
+ dir = PUBCONF_PATH;
+ }
- cfg->config_dir = strdup(dir);
- if (!cfg->config_dir) {
- ret = ENOMEM;
- goto done;
+ if (dir) {
+ cfg->config_dir = strdup(dir);
+ if (!cfg->config_dir) {
+ ret = ENOMEM;
+ goto done;
+ }
}
if (socket_name) socket = socket_name;