summaryrefslogtreecommitdiff
path: root/ndb/src
diff options
context:
space:
mode:
authorjonas@perch.ndb.mysql.com <>2006-11-21 11:57:41 +0100
committerjonas@perch.ndb.mysql.com <>2006-11-21 11:57:41 +0100
commitac79cbb1f8b65349aed95971f19fdf0d8c993222 (patch)
tree87b0f62afe1dc2698eea505151575da1b12c1b57 /ndb/src
parentc8d07748c258f8ff5806a81592deb0edfd39165d (diff)
downloadmariadb-git-ac79cbb1f8b65349aed95971f19fdf0d8c993222.tar.gz
ndb -
Fix bug wrt to '\r' handling in latest commit to bug#24011
Diffstat (limited to 'ndb/src')
-rw-r--r--ndb/src/common/util/InputStream.cpp10
-rw-r--r--ndb/src/common/util/socket_io.cpp5
2 files changed, 7 insertions, 8 deletions
diff --git a/ndb/src/common/util/InputStream.cpp b/ndb/src/common/util/InputStream.cpp
index 410e9a70e9c..befd5cbf82a 100644
--- a/ndb/src/common/util/InputStream.cpp
+++ b/ndb/src/common/util/InputStream.cpp
@@ -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;
}
diff --git a/ndb/src/common/util/socket_io.cpp b/ndb/src/common/util/socket_io.cpp
index 96efbac57d7..9401d1cd6d0 100644
--- a/ndb/src/common/util/socket_io.cpp
+++ b/ndb/src/common/util/socket_io.cpp
@@ -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;
}