summaryrefslogtreecommitdiff
path: root/sensors-service/src/sns-use-replayer.c
diff options
context:
space:
mode:
Diffstat (limited to 'sensors-service/src/sns-use-replayer.c')
-rw-r--r--sensors-service/src/sns-use-replayer.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sensors-service/src/sns-use-replayer.c b/sensors-service/src/sns-use-replayer.c
index 46df7e5..3dbd1a3 100644
--- a/sensors-service/src/sns-use-replayer.c
+++ b/sensors-service/src/sns-use-replayer.c
@@ -305,6 +305,7 @@ void *listenForMessages( void *ptr )
struct sockaddr_in si_other;
int s;
socklen_t slen = sizeof(si_other);
+ ssize_t readBytes = 0;
char buf[BUFLEN];
char msgId[MSGIDLEN];
int port = PORT;
@@ -333,11 +334,15 @@ void *listenForMessages( void *ptr )
while(isRunning == true)
{
- if(recvfrom(s, buf, BUFLEN, 0, (struct sockaddr *)&si_other, &slen) == -1)
+ readBytes = recvfrom(s, buf, BUFLEN, 0, (struct sockaddr *)&si_other, &slen);
+
+ if(readBytes < 0)
{
LOG_ERROR_MSG(gContext,"recvfrom() failed!");
exit(EXIT_FAILURE);
}
+
+ buf[readBytes] = '\0';
LOG_DEBUG_MSG(gContext,"------------------------------------------------");