summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-store.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-store.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index 900c12a82da..56b75ec90f3 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -566,6 +566,8 @@ void _storeopts (dict_t *this, char *key, data_t *value, void *data)
int32_t
glusterd_volume_exclude_options_write (int fd, glusterd_volinfo_t *volinfo)
{
+ char *str = NULL;
+
GF_ASSERT (fd > 0);
GF_ASSERT (volinfo);
@@ -631,15 +633,23 @@ glusterd_volume_exclude_options_write (int fd, glusterd_volinfo_t *volinfo)
if (ret)
goto out;
- ret = glusterd_store_save_value (fd, GLUSTERD_STORE_KEY_USERNAME,
- glusterd_auth_get_username (volinfo));
- if (ret)
+ str = glusterd_auth_get_username (volinfo);
+ if (str) {
+ ret = glusterd_store_save_value (fd,
+ GLUSTERD_STORE_KEY_USERNAME,
+ str);
+ if (ret)
goto out;
+ }
- ret = glusterd_store_save_value (fd, GLUSTERD_STORE_KEY_PASSWORD,
- glusterd_auth_get_password (volinfo));
- if (ret)
- goto out;
+ str = glusterd_auth_get_password (volinfo);
+ if (str) {
+ ret = glusterd_store_save_value (fd,
+ GLUSTERD_STORE_KEY_PASSWORD,
+ str);
+ if (ret)
+ goto out;
+ }
out:
if (ret)