tcpflood bugfix: plain tcp send error not properly reported

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.
This commit is contained in:
Rainer Gerhards 2023-09-13 09:33:40 +02:00
parent db6ef15992
commit c8a2969580
No known key found for this signature in database
GPG Key ID: 0CB6B2A8BE80B499

View File

@ -665,10 +665,10 @@ finalize_it: /*EMPTY to keep the compiler happy */;
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) {
@ -676,7 +676,7 @@ sendPlainTCP(int socknum, char *buf, size_t lenBuf, int *ret_errno)
if(r > 0) {
lenSent += r;
} else {
err = errno;
*ret_errno = errno;
goto finalize_it;
}
}