summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorratchov <ratchov@openbsd.org>2008-11-16 21:16:08 +0000
committerratchov <ratchov@openbsd.org>2008-11-16 21:16:08 +0000
commitbeb2acbb45a1faa5888edf513d378f92c0622298 (patch)
tree9a44f836feb33df673491c66397cca3b325fa760
parentaucat stops the device when idle, remove the corresponding (diff)
downloadwireguard-openbsd-beb2acbb45a1faa5888edf513d378f92c0622298.tar.xz
wireguard-openbsd-beb2acbb45a1faa5888edf513d378f92c0622298.zip
trigger rproc->eof() and and wproc->hup() if POLLHUP event is set.
Fixes aucat sleeping forever when the devices disappears
-rw-r--r--usr.bin/aucat/file.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/aucat/file.c b/usr.bin/aucat/file.c
index 18da0f25d94..fdca8f99300 100644
--- a/usr.bin/aucat/file.c
+++ b/usr.bin/aucat/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.6 2008/11/16 17:08:32 ratchov Exp $ */
+/* $OpenBSD: file.c,v 1.7 2008/11/16 21:16:08 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -187,6 +187,10 @@ file_poll(void)
break;
}
}
+ if (!(f->state & FILE_ZOMB) && (revents & POLLHUP)) {
+ DPRINTFN(2, "file_poll: %s: disconnected\n", f->name);
+ f->state |= (FILE_EOF | FILE_HUP);
+ }
if (!(f->state & FILE_ZOMB) && (f->state & FILE_EOF)) {
DPRINTFN(2, "file_poll: %s: eof\n", f->name);
p = f->rproc;