Commit b6ed727a4570a506473c481a344880f99b4ef64d

Vicent Martí 2011-09-18T19:52:40

Merge pull request #392 from sschuberth/development Fix a bug and GCC warning introduced in 932669b

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/src/config_file.c b/src/config_file.c
index f7e6f61..3804f97 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -535,10 +535,8 @@ static char *cfg_readline(diskfile_backend *cfg)
 
 	memcpy(line, line_src, line_len);
 
-	line[line_len] = '\0';
-
-	while (--line_len >= 0 && isspace(line[line_len]))
-		line[line_len] = '\0';
+	do line[line_len] = '\0';
+	while (line_len-- > 0 && isspace(line[line_len]));
 
 	if (*line_end == '\n')
 		line_end++;