Skip to content

Commit

Permalink
tcpflood bugfix: plain tcp send error not properly reported
Browse files Browse the repository at this point in the history
The error code when plain tcp sending failed was improperly returned,
resulting in no meaningful error message.

Note: tcpflood is a testbench tool, not part of production rsyslog.
  • Loading branch information
rgerhards committed Sep 13, 2023
1 parent db6ef15 commit c8a2969
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/tcpflood.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,18 +665,18 @@ genMsg(char *buf, size_t maxBuf, size_t *pLenBuf, struct instdata *inst)


static int
sendPlainTCP(int socknum, char *buf, size_t lenBuf, int *ret_errno)
sendPlainTCP(const int socknum, const char *const buf, const size_t lenBuf, int *const ret_errno)
{
size_t lenSent;
int r, err;
int r;

lenSent = 0;
while(lenSent != lenBuf) {
r = send(sockArray[socknum], buf + lenSent, lenBuf - lenSent, 0);
if(r > 0) {
lenSent += r;
} else {
err = errno;
*ret_errno = errno;
goto finalize_it;
}
}
Expand Down

0 comments on commit c8a2969

Please sign in to comment.