Skip to content
  • Petri Latvala's avatar
    testdisplay: Don't double-close udev fd · 732d9977
    Petri Latvala authored
    
    
    testdisplay uses GIO for polling the udev fd for events. When shutting
    down, both the GIO channel and libudev want to close their respective
    fds, leading to a double close.
    
    Since version 240 (as used by Ubuntu 19.04), libudev has complained
    loudly if close() fails with EBADF. Previously the error has flown
    under the radar.
    
    Calling g_io_channel_shutdown() will call close() on the fd regardless
    of g_io_channel_set_close_on_unref, so opencode the flush and unref
    instead to avoid double closing.
    
    Signed-off-by: default avatarPetri Latvala <petri.latvala@intel.com>
    Cc: Jani Saarinen <jani.saarinen@intel.com>
    Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
    Tested-by: default avatarJani Saarinen <jani.saarinen@intel.com>
    Reviewed-by: default avatarMika Kahola <mika.kahola@intel.com>
    732d9977