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>
diff --git a/libsysutils/src/SocketClient.cpp b/libsysutils/src/SocketClient.cpp
index f0e846f..857ed4d 100644
--- a/libsysutils/src/SocketClient.cpp
+++ b/libsysutils/src/SocketClient.cpp
@@ -33,19 +33,10 @@
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) {