diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-09-18 16:26:26 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-09-18 16:26:26 -0400 |
commit | aecb837a5cf531d83aebe7666f400d56fa3ab1ed (patch) | |
tree | 7b5a7c78987f85419184556a894551c3172778a9 /test | |
parent | 405ba31245d0916895e707b8c10cc71cf40045a0 (diff) |
test/runner: only add a newline if there isn't one already
Diffstat (limited to 'test')
-rw-r--r-- | test/runner.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/runner.c b/test/runner.c index e1aed70..9edd191 100644 --- a/test/runner.c +++ b/test/runner.c @@ -130,8 +130,10 @@ int main(int argc, char *argv[]) { ssize_t bytes_read = recvfrom(notify_sock, buf, sizeof(buf)-1, 0, &client_addr.gen, &client_size); if (bytes_read < 1) error(EXIT_FAILURE, errno, "recvfrom"); - buf[bytes_read] = '\n'; - bytes_read++; + if (buf[bytes_read-1] != '\n') { + buf[bytes_read] = '\n'; + bytes_read++; + } ssize_t bytes_written = 0; while (bytes_written < bytes_read) { ssize_t n = write(2, &(buf[bytes_written]), bytes_read-bytes_written); |