summaryrefslogtreecommitdiff
path: root/regress/usr.sbin/syslogd/funcs.pl
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2015-01-15 13:15:18 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2015-01-15 13:15:18 +0000
commit2b80b29ebec132dcb0d7fd483dd11728db66dc21 (patch)
tree6decb31e701d2b1866be6376eeac37c1cf635720 /regress/usr.sbin/syslogd/funcs.pl
parent982b97b5bd3344bf8ab9f25588df649cf052eb85 (diff)
Add a test for syslogd that reconnects to a TCP syslog server after
an established connection has been closed.
Diffstat (limited to 'regress/usr.sbin/syslogd/funcs.pl')
-rw-r--r--regress/usr.sbin/syslogd/funcs.pl15
1 files changed, 10 insertions, 5 deletions
diff --git a/regress/usr.sbin/syslogd/funcs.pl b/regress/usr.sbin/syslogd/funcs.pl
index 382ab1f8f70..93440059fd8 100644
--- a/regress/usr.sbin/syslogd/funcs.pl
+++ b/regress/usr.sbin/syslogd/funcs.pl
@@ -1,4 +1,4 @@
-# $OpenBSD: funcs.pl,v 1.9 2015/01/01 19:58:48 bluhm Exp $
+# $OpenBSD: funcs.pl,v 1.10 2015/01/15 13:15:17 bluhm Exp $
# Copyright (c) 2010-2015 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -131,10 +131,15 @@ sub read_message {
local $_;
for (;;) {
- # reading udp packets works only with sysread()
- defined(my $n = sysread(STDIN, $_, 8194))
- or die ref($self), " read log line failed: $!";
- last if $n == 0;
+ if ($self->{listenproto} eq "udp") {
+ # reading udp packets works only with sysread()
+ defined(my $n = sysread(STDIN, $_, 8194))
+ or die ref($self), " read log line failed: $!";
+ last if $n == 0;
+ } else {
+ defined($_ = <STDIN>)
+ or last;
+ }
chomp;
print STDERR ">>> $_\n";
last if /$regex/;