summaryrefslogtreecommitdiffstats
path: root/tests/nettester.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-07-09 16:35:13 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-07-09 16:35:13 +0200
commitab40107149038898ef24479a6911d9cd7770a56c (patch)
tree7a4bd016dd56583263c63e10808859c6ef848ffc /tests/nettester.c
parent5221a1e42e16c8c39b48a4a1a18ee6322c38cd17 (diff)
parent9de685929e4c202d470e07ec28fda41a5efc8eaf (diff)
downloadrsyslog-ab40107149038898ef24479a6911d9cd7770a56c.tar.gz
rsyslog-ab40107149038898ef24479a6911d9cd7770a56c.tar.xz
rsyslog-ab40107149038898ef24479a6911d9cd7770a56c.zip
Merge branch 'v4-beta' into v4-devel
Conflicts: tests/nettester.c
Diffstat (limited to 'tests/nettester.c')
-rw-r--r--tests/nettester.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/tests/nettester.c b/tests/nettester.c
index 73abc46e..209c2a6f 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,8 +147,7 @@ tcpSend(char *buf, int lenBuf)
fprintf(stderr, "connect() failed\n");
return(1);
} else {
- fprintf(stderr, "connect() failed, retry %d\n", retries);
- usleep(100000); /* ms = 1000 us! */
+ usleep(100000); /* 0.1 sec, these are us! */
}
}
}
@@ -209,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;