summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-12-15 01:50:04 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:30 -0500
commit728bee7ff3672e7f658912179cd77d5dc4842e86 (patch)
treea06bb86446e6142b9edf866ca2a2da5044cb350a /source3
parentd29722e378011e6085e007e1e6c39a9f002eb2fe (diff)
downloadsamba-728bee7ff3672e7f658912179cd77d5dc4842e86.tar.gz
samba-728bee7ff3672e7f658912179cd77d5dc4842e86.tar.bz2
samba-728bee7ff3672e7f658912179cd77d5dc4842e86.zip
r20179: Sync up with Samba4 - remove blank lines at the
end parsing a file. Jeremy. (This used to be commit ea8215935e5f3952a4480c1f7dafafa9458f66a9)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/util_file.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source3/lib/util_file.c b/source3/lib/util_file.c
index 1e0d880e83..03246cad8e 100644
--- a/source3/lib/util_file.c
+++ b/source3/lib/util_file.c
@@ -285,9 +285,6 @@ static char **file_lines_parse(char *p, size_t size, int *numlines)
return NULL;
}
memset(ret, 0, sizeof(ret[0])*(i+2));
- if (numlines) {
- *numlines = i;
- }
ret[0] = p;
for (s = p, i=0; s < p+size; s++) {
@@ -301,6 +298,15 @@ static char **file_lines_parse(char *p, size_t size, int *numlines)
}
}
+ /* remove any blank lines at the end */
+ while (i > 0 && ret[i-1][0] == 0) {
+ i--;
+ }
+
+ if (numlines) {
+ *numlines = i;
+ }
+
return ret;
}