aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Łyszczek <michal.lyszczek@bofc.pl>2021-05-20 01:09:40 +0200
committerMichał Łyszczek <michal.lyszczek@bofc.pl>2021-05-21 02:33:54 +0200
commit99234e7a9dc7a0a76c0122c2eab6846cef360f93 (patch)
tree92b85587137eee2d32589a036e20e424a5466d39
parent83b416299abac3879c508ce309bd957c172a84dd (diff)
downloadpsmq-99234e7a9dc7a0a76c0122c2eab6846cef360f93.tar.gz
psmq-99234e7a9dc7a0a76c0122c2eab6846cef360f93.tar.bz2
psmq-99234e7a9dc7a0a76c0122c2eab6846cef360f93.zip
src/psmq-pub.c: fix extra bytes sent with stdin
When message was read from stdin, psmq-pub was publishing newline and null character. It was not suppose to do that. psmq-pub should send one message per newline, and it's common to not send new line character in that situation. Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
-rw-r--r--src/psmq-pub.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/psmq-pub.c b/src/psmq-pub.c
index 0b9aa3d..63f0917 100644
--- a/src/psmq-pub.c
+++ b/src/psmq-pub.c
@@ -165,7 +165,7 @@ static void send_stdin
/* now we have full line in buffer, ship
* it. -1 is just so publish don't send
* newline character */
- if (publish(psmq, topic, line, strlen(line) + 1, prio) != 0)
+ if (publish(psmq, topic, line, strlen(line) - 1, prio) != 0)
return;
}
}