diff options
author | San Mehat <san@google.com> | 2009-06-15 14:06:03 -0700 |
---|---|---|
committer | San Mehat <san@google.com> | 2009-06-15 14:06:03 -0700 |
commit | c73a3a5771a2d29d1bae666bfde12f751d66fc96 (patch) | |
tree | da254373f3ec359d7352efcd146ef6905b08cf42 /libsysutils/src/SocketClient.cpp | |
parent | 47c1d7344ab183f5440843f6b594d1b74a2335b0 (diff) |
libsysutils: Move to a null terminated string protocol using space as a field separator.
Also removes some debugging
Signed-off-by: San Mehat <san@google.com>
Diffstat (limited to 'libsysutils/src/SocketClient.cpp')
-rw-r--r-- | libsysutils/src/SocketClient.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/libsysutils/src/SocketClient.cpp b/libsysutils/src/SocketClient.cpp index f0e846f4f..857ed4d10 100644 --- a/libsysutils/src/SocketClient.cpp +++ b/libsysutils/src/SocketClient.cpp @@ -33,19 +33,10 @@ int SocketClient::sendMsg(const char *msg) { return -1; } - char *tmp; - const char *bp = msg; - - if (msg[strlen(msg)] != '\n') { - tmp = (char *) alloca(strlen(msg) + 1); - strcpy(tmp, msg); - strcat(tmp, "\n"); - bp = tmp; - } - + // Send the message including null character int rc = 0; - const char *p = bp; - int brtw = strlen(bp); + const char *p = msg; + int brtw = strlen(msg) + 1; pthread_mutex_lock(&mWriteMutex); while(brtw) { |