Commit 01797892 authored by unknown's avatar unknown

ndb -

  Fix bug wrt to '\r' handling in latest commit to bug#24011


ndb/src/common/util/InputStream.cpp:
  Fix bug wrt to '\r' handling in latest commit to bug#24011
ndb/src/common/util/socket_io.cpp:
  Fix bug wrt to '\r' handling in latest commit to bug#24011
parent 1ef8fe5a
......@@ -47,15 +47,9 @@ SocketInputStream::gets(char * buf, int bufLen) {
int res = readln_socket(m_socket, m_timeout, buf, bufLen - 1);
if(res == -1)
return 0;
if(res == 0 && buf[0] == 77){ // select return 0
if(res == 0 && buf[0] == 77)
{ // select return 0
buf[0] = 0;
} else if(res == 0 && buf[0] == 0){ // only newline
buf[0] = '\n';
buf[1] = 0;
} else {
int len = strlen(buf);
buf[len + 1] = '\0';
buf[len] = '\n';
}
return buf;
}
......@@ -98,6 +98,11 @@ readln_socket(NDB_SOCKET_TYPE socket, int timeout_millis,
ptr += t;
len -= t;
}
if (i > 0 && buf[i-1] == '\r')
{
buf[i-1] = '\n';
ptr--;
}
ptr[0]= 0;
return ptr - buf;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment