diff --git a/src/shared/io-glib.c b/src/shared/io-glib.c
index 6687a6b..d62de4e 100644
--- a/src/shared/io-glib.c
+++ b/src/shared/io-glib.c
io_destroy_func_t destroy)
{
struct io_watch *watch;
+ int prio;
watch = g_try_new0(struct io_watch, 1);
if (!watch)
watch->destroy = destroy;
watch->user_data = user_data;
- watch->id = g_io_add_watch_full(io->channel, G_PRIORITY_DEFAULT,
+ prio = cond == G_IO_HUP ? G_PRIORITY_DEFAULT_IDLE : G_PRIORITY_DEFAULT;
+
+ watch->id = g_io_add_watch_full(io->channel, prio,
cond | G_IO_ERR | G_IO_NVAL,
watch_callback, watch,
watch_destroy);