diff options
author | Hwankyu Jhun <h.jhun@samsung.com> | 2016-03-04 09:30:33 +0900 |
---|---|---|
committer | Hwankyu Jhun <h.jhun@samsung.com> | 2016-03-04 09:30:33 +0900 |
commit | 71e35957a0f2f05f906b3ac891620c1d7b7e383e (patch) | |
tree | 672711d083ff88282b8411b7e20d99b2169fa773 | |
parent | 560e2c2fc0c562b3f8df96bfe576a194b35ab897 (diff) | |
download | launchpad-71e35957a0f2f05f906b3ac891620c1d7b7e383e.tar.gz launchpad-71e35957a0f2f05f906b3ac891620c1d7b7e383e.tar.bz2 launchpad-71e35957a0f2f05f906b3ac891620c1d7b7e383e.zip |
Fix the returned value of __poll_fd()
Change-Id: I934d3a9ef5eb47f0bd8035ceeb272d56604376a5
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
-rwxr-xr-x | src/launchpad.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/launchpad.c b/src/launchpad.c index 5f609e7..3c53dab 100755 --- a/src/launchpad.c +++ b/src/launchpad.c @@ -660,7 +660,7 @@ static GSourceFuncs funcs = { .finalize = NULL }; -static int __poll_fd(int fd, gushort events, GSourceFunc func, int type, int loader_id) +static guint __poll_fd(int fd, gushort events, GSourceFunc func, int type, int loader_id) { int r; GPollFD *gpollfd; @@ -669,14 +669,14 @@ static int __poll_fd(int fd, gushort events, GSourceFunc func, int type, int loa src = g_source_new(&funcs, sizeof(GSource)); if (!src) { _E("out of memory"); - return -1; + return 0; } gpollfd = (GPollFD *) g_malloc(sizeof(GPollFD)); if (!gpollfd) { _E("out of memory"); g_source_destroy(src); - return -1; + return 0; } gpollfd->events = events; @@ -686,7 +686,7 @@ static int __poll_fd(int fd, gushort events, GSourceFunc func, int type, int loa if (lc == NULL) { g_free(gpollfd); g_source_destroy(src); - return -1; + return 0; } lc->gpollfd = gpollfd; @@ -702,7 +702,7 @@ static int __poll_fd(int fd, gushort events, GSourceFunc func, int type, int loa if (r == 0) { g_free(gpollfd); g_source_destroy(src); - return -1; + return 0; } return r; @@ -764,7 +764,7 @@ static gboolean __handle_loader_event(gpointer data) cpc->source = __poll_fd(client_fd, G_IO_IN | G_IO_HUP, (GSourceFunc)__handle_loader_client_event, type, loader_id); - if (cpc->source < 0) + if (cpc->source == 0) close(client_fd); } } else { @@ -1058,7 +1058,7 @@ static candidate_process_context_t* __add_slot(int type, int loader_id, int call return NULL; } - if (__poll_fd(fd, G_IO_IN, (GSourceFunc)__handle_loader_event, cpc->type, cpc->loader_id) < 0) { + if (__poll_fd(fd, G_IO_IN, (GSourceFunc)__handle_loader_event, cpc->type, cpc->loader_id) == 0) { close(fd); free(cpc); return NULL; @@ -1110,7 +1110,7 @@ static int __init_launchpad_fd(int argc, char **argv) return -1; } - if (__poll_fd(fd, G_IO_IN, (GSourceFunc)__handle_launch_event, 0, 0) < 0) { + if (__poll_fd(fd, G_IO_IN, (GSourceFunc)__handle_launch_event, 0, 0) == 0) { close(fd); return -1; } @@ -1128,7 +1128,7 @@ static int __init_sigchild_fd(void) return -1; } - if (__poll_fd(fd, G_IO_IN, (GSourceFunc)__handle_sigchild, 0, 0) < 0) { + if (__poll_fd(fd, G_IO_IN, (GSourceFunc)__handle_sigchild, 0, 0) == 0) { close(fd); return -1; } |