diff options
author | Gaurav Yadav <gyadav@redhat.com> | 2017-08-18 19:46:47 +0530 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2017-08-24 10:39:10 +0000 |
commit | 470fcc266215b48ddea65e9e641c4a750d6358db (patch) | |
tree | 295dc0a492dc53a1662d8e3b43e3d6f62ce114f8 /libglusterfs | |
parent | e893962deaabab8e934813f8a0443a8f94e009f2 (diff) |
glusterd: glusterd fails to start if peers file has blank line
Problem:
On start of glusterd service, glusterd fetch data from store, while
parsing data from store if peers file consists of blank line glusterd
fails to start.
Fix:
With this fix while parsing peers file glusterd will skip blank lines
if it contains any.
Signed-off-by: Gaurav Yadav <gyadav@redhat.com>
Change-Id: I53cd65a54de5f57baef292b2118b70ffb7f99388
BUG: 1482906
Reviewed-on: https://review.gluster.org/18066
Tested-by: Gaurav Yadav <gyadav@redhat.com>
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Prashanth Pai <ppai@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/store.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libglusterfs/src/store.c b/libglusterfs/src/store.c index 199ba2960d1..e805f20bb4c 100644 --- a/libglusterfs/src/store.c +++ b/libglusterfs/src/store.c @@ -195,6 +195,7 @@ gf_store_read_and_tokenize (FILE *file, char *str, int size, char **iter_key, GF_ASSERT (iter_val); GF_ASSERT (store_errno); +retry: temp = fgets (str, size, file); if (temp == NULL || feof (file)) { ret = -1; @@ -202,6 +203,9 @@ gf_store_read_and_tokenize (FILE *file, char *str, int size, char **iter_key, goto out; } + if (strcmp (str, "\n") == 0) + goto retry; + str_len = strlen(str); str[str_len - 1] = '\0'; /* Truncate the "\n", as fgets stores "\n" in str */ |