From: INSUN PYO Date: Wed, 14 Jul 2021 05:46:29 +0000 (+0900) Subject: common: improve G_IO_ERR | G_IO_HUP handling X-Git-Tag: submit/tizen/20210714.103132^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8549a2b26dbe4d4ec2ec6ec3b4e1c320becd27d2;p=platform%2Fcore%2Fsystem%2Fstoraged.git common: improve G_IO_ERR | G_IO_HUP handling Change-Id: I00f7434b06a6580f9e19e780d028466ce6085e5c --- diff --git a/src/shared/fd_handler.c b/src/shared/fd_handler.c index e9927a2..fb65878 100644 --- a/src/shared/fd_handler.c +++ b/src/shared/fd_handler.c @@ -73,13 +73,12 @@ static gboolean channel_changed(GIOChannel *source, if (h->fd != g_io_channel_unix_get_fd(source)) return TRUE; + if (condition & (G_IO_ERR | G_IO_HUP)) + _E("GIOChannel receives G_IO_ERR|G_IO_HUP fd = %d condition = %d", h->fd, condition); - if (condition & G_IO_ERR) - _E("udev_monitor_set_receive_buffer_size overflow."); - - if (!(condition & G_IO_IN)) { - _D("udev have a bad behavior."); - return TRUE; + if (!(condition & G_IO_IN) && (condition & (G_IO_ERR | G_IO_HUP))) { + remove_fd_read_handler((fd_handler_h *)&h); + return FALSE; } ret = true; @@ -116,7 +115,7 @@ int add_fd_read_handler(int fd, return -ENOMEM; } - id = g_io_add_watch(ch, G_IO_IN | G_IO_ERR, + id = g_io_add_watch(ch, G_IO_IN | G_IO_ERR | G_IO_HUP, channel_changed, h); if (id == 0) { _E("Failed to add watch for GIOChannel.");