summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2014-02-04 04:36:19 +0000
committerRajesh Joseph <rjoseph@redhat.com>2014-02-04 22:56:51 -0800
commitd382c7a7fdf92047655aa54e07a42d346d1d422a (patch)
treece45465eb4fd35385bf72ec85aa3801b7552430e /libglusterfs
parentbea2e811a5fe9b84a1a46f6403d4291ba16965be (diff)
glusterd: Handling eof during gf_store_read_and_tokenize
Change-Id: I88eeffd64c521db78b9e7539ae57ed046854cb63 BUG: 1049278 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/6903 Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-by: Sachin Pandit <spandit@redhat.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Tested-by: Rajesh Joseph <rjoseph@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/store.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libglusterfs/src/store.c b/libglusterfs/src/store.c
index 64497e9bb..1e6601837 100644
--- a/libglusterfs/src/store.c
+++ b/libglusterfs/src/store.c
@@ -182,16 +182,16 @@ gf_store_read_and_tokenize (FILE *file, char *str, char **iter_key,
GF_ASSERT (store_errno);
temp = fgets (str, PATH_MAX, file);
- str_len = strlen(str);
- str[str_len - 1] = '\0';
- /* Truncate the "\n", as fgets stores "\n" in str */
-
if (temp == NULL || feof (file)) {
ret = -1;
*store_errno = GD_STORE_EOF;
goto out;
}
+ str_len = strlen(str);
+ str[str_len - 1] = '\0';
+ /* Truncate the "\n", as fgets stores "\n" in str */
+
key = strtok_r (str, "=", &savetok);
if (!key) {
ret = -1;