summaryrefslogtreecommitdiffstats
path: root/tests/nettester.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-07-09 16:32:14 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-07-09 16:32:14 +0200
commit9de685929e4c202d470e07ec28fda41a5efc8eaf (patch)
treed64599ac8dee82c96cebb641af24d04befd98f63 /tests/nettester.c
parent92020c6ea15215af1ea361c8fe010b604653b8f7 (diff)
downloadrsyslog-9de685929e4c202d470e07ec28fda41a5efc8eaf.tar.gz
rsyslog-9de685929e4c202d470e07ec28fda41a5efc8eaf.tar.xz
rsyslog-9de685929e4c202d470e07ec28fda41a5efc8eaf.zip
bugfix: message could be truncated after TAG, often when forwarding
This was a result of an internal processing error if maximum field sizes had been specified in the property replacer. Also did some testbench improvements, including omstdout.
Diffstat (limited to 'tests/nettester.c')
-rw-r--r--tests/nettester.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/tests/nettester.c b/tests/nettester.c
index dbfb4db3..b5da8ee8 100644
--- a/tests/nettester.c
+++ b/tests/nettester.c
@@ -38,6 +38,7 @@
#include <sys/socket.h>
#include <sys/wait.h>
#include <sys/stat.h>
+#include <sys/time.h>
#include <arpa/inet.h>
#include <assert.h>
#include <unistd.h>
@@ -82,14 +83,27 @@ static char *inputMode2Str(inputMode_t mode)
void readLine(int fd, char *ln)
{
+ char *orig = ln;
char c;
int lenRead;
+
+ if(verbose)
+ fprintf(stderr, "begin readLine\n");
lenRead = read(fd, &c, 1);
while(lenRead == 1 && c != '\n') {
+ if(c == '\0') {
+ *ln = c;
+ fprintf(stderr, "Warning: there was a '\\0'-Byte in the read response "
+ "right after this string: '%s'\n", orig);
+ c = '?';
+ }
*ln++ = c;
- lenRead = read(fd, &c, 1);
+ lenRead = read(fd, &c, 1);
}
*ln = '\0';
+
+ if(verbose)
+ fprintf(stderr, "end readLine, val read '%s'\n", orig);
}
@@ -133,7 +147,7 @@ tcpSend(char *buf, int lenBuf)
fprintf(stderr, "connect() failed\n");
return(1);
} else {
- usleep(100);
+ usleep(100000); /* 0.1 sec, these are us! */
}
}
}
@@ -208,7 +222,6 @@ int openPipe(char *configFile, pid_t *pid, int *pfd)
"RSYSLOG_DEBUGLOG=log", NULL };
*/
-
sprintf(confFile, "-f%s/testsuites/%s.conf", srcdir,
(pszCustomConf == NULL) ? configFile : pszCustomConf);
newargv[1] = confFile;