G_IO_HUP should be checked before G_IO_IN