projects
/
ust.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
libtracectl: add \0 at end of received msg
[ust.git]
/
libtracectl
/
tracectl.c
diff --git
a/libtracectl/tracectl.c
b/libtracectl/tracectl.c
index a2521585b336f204d56cf1ef7b8489d18d242578..a25bd3b214dd0018b2765f3363ec2296e7d6a4de 100644
(file)
--- a/
libtracectl/tracectl.c
+++ b/
libtracectl/tracectl.c
@@
-228,7
+228,7
@@
int listener_main(void *p)
struct trctl_msg msg;
int len;
struct trctl_msg msg;
int len;
- result = len = recvfrom(pfd, recvbuf, sizeof(recvbuf), 0, &addr, &addrlen);
+ result = len = recvfrom(pfd, recvbuf, sizeof(recvbuf
-1
), 0, &addr, &addrlen);
if(result == -1) {
PERROR("recvfrom");
continue;
if(result == -1) {
PERROR("recvfrom");
continue;
@@
-236,6
+236,8
@@
int listener_main(void *p)
if(recvbuf[len-1] == '\n')
recvbuf[len-1] = '\0';
if(recvbuf[len-1] == '\n')
recvbuf[len-1] = '\0';
+ else
+ recvbuf[len] = 0;
fprintf(stderr, "received a message! it's: %s\n", recvbuf);
fprintf(stderr, "received a message! it's: %s\n", recvbuf);
This page took
0.024078 seconds
and
4
git commands to generate.