diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2008-11-16 21:16:09 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2008-11-16 21:16:09 +0000 |
commit | 8b1e1575ae74077ee992464a321959656f72b952 (patch) | |
tree | 545ea45450b6372a71f96022890a68ed4c01285e | |
parent | f400a6d424383b35a992c14ff2b2cc8c2556562d (diff) |
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.c | 6 |
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; |