[Pkg-wmaker-commits] [wmbiff] 09/14: bugfix to avoid handing odd newlines badly
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Thu Aug 20 03:04:00 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to tag wmbiff_0_4_17
in repository wmbiff.
commit 227871d3b7d5c506c2eadddd1074b3e35a1af0e6
Author: bluehal <bluehal>
Date: Sun Aug 31 03:32:58 2003 +0000
bugfix to avoid handing odd newlines badly
---
wmbiff/tlsComm.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/wmbiff/tlsComm.c b/wmbiff/tlsComm.c
index c6db9b0..1f2b1e1 100644
--- a/wmbiff/tlsComm.c
+++ b/wmbiff/tlsComm.c
@@ -70,7 +70,7 @@ struct connection_state {
};
/* gotta do our own line buffering, sigh */
-static int
+int
getline_from_buffer(char *readbuffer, char *linebuffer, int linebuflen);
void handle_gnutls_read_error(int readbytes, struct connection_state *scs);
@@ -124,8 +124,7 @@ static int wait_for_it(int sd, int timeoutseconds)
return (FD_ISSET(sd, &readfds));
}
-static int
-getline_from_buffer(char *readbuffer, char *linebuffer, int linebuflen)
+int getline_from_buffer(char *readbuffer, char *linebuffer, int linebuflen)
{
char *p, *q;
int i;
@@ -133,6 +132,14 @@ getline_from_buffer(char *readbuffer, char *linebuffer, int linebuflen)
for (p = readbuffer, i = 0;
*p != '\n' && *p != '\0' && i < linebuflen - 1; p++, i++);
+ /* gobble \n if it starts the line. */
+ if (*p == '\n') {
+ /* grab the end of line too! and then advance past
+ the newline */
+ i++;
+ p++;
+ }
+
if (i != 0) {
/* grab the end of line too! */
i++;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbiff.git
More information about the Pkg-wmaker-commits
mailing list