If the keyboard is unplugged, it looks like the kernel is reporting back -ENODEV when trying to close the fd. This is probably a kernel error, but still, it's better to complain than to crash. Buglink: https://bugs.freedesktop.org/show_bug.cgi?id=80867 Reported-by: Stelios Bounanos Signed-off-by: David Henningsson <david.henningsson at canonical.com> --- src/modules/module-mmkbd-evdev.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/module-mmkbd-evdev.c b/src/modules/module-mmkbd-evdev.c index 9ab7eb9..0b04f0f 100644 --- a/src/modules/module-mmkbd-evdev.c +++ b/src/modules/module-mmkbd-evdev.c @@ -256,8 +256,11 @@ void pa__done(pa_module*m) { if (u->io) m->core->mainloop->io_free(u->io); - if (u->fd >= 0) - pa_assert_se(pa_close(u->fd) == 0); + if (u->fd >= 0) { + int r = pa_close(u->fd); + if (r < 0) /* https://bugs.freedesktop.org/show_bug.cgi?id=80867 */ + pa_log("Closing fd failed: %s", pa_cstrerror(errno)); + } pa_xfree(u->sink_name); pa_xfree(u); -- 1.9.1