Skip to content

Commit

Permalink
example/test: check for error in qb_ipc_run()
Browse files Browse the repository at this point in the history
Hopefully all of them this time.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
  • Loading branch information
asalkeld committed Nov 8, 2012
1 parent ecf3d6f commit c533b24
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
7 changes: 6 additions & 1 deletion examples/ipcserver.c
Expand Up @@ -352,7 +352,12 @@ main(int32_t argc, char *argv[])
glib_loop = g_main_loop_new(NULL, FALSE);
gio_map = qb_array_create_2(16, sizeof(struct gio_to_qb_poll), 1);
qb_ipcs_poll_handlers_set(s1, &glib_ph);
qb_ipcs_run(s1);
rc = qb_ipcs_run(s1);
if (rc != 0) {
errno = -rc;
qb_perror(LOG_ERR, "qb_ipcs_run");
exit(1);
}
g_main_loop_run(glib_loop);
#else
qb_log(LOG_ERR,
Expand Down
15 changes: 13 additions & 2 deletions tests/bms.c
Expand Up @@ -255,6 +255,7 @@ int32_t main(int32_t argc, char *argv[])
{
const char *options = "nevhmpsug";
int32_t opt;
int32_t rc;
enum qb_ipc_type ipc_type = QB_IPC_SHM;
struct qb_ipcs_service_handlers sh = {
.connection_accept = s1_connection_accept_fn,
Expand Down Expand Up @@ -323,7 +324,12 @@ int32_t main(int32_t argc, char *argv[])
exit(1);
}
qb_ipcs_poll_handlers_set(s1, &ph);
qb_ipcs_run(s1);
rc = qb_ipcs_run(s1);
if (rc != 0) {
errno = -rc;
qb_perror(LOG_ERR, "qb_ipcs_run");
exit(1);
}
qb_loop_run(bms_loop);
} else {
#ifdef HAVE_GLIB
Expand All @@ -337,7 +343,12 @@ int32_t main(int32_t argc, char *argv[])
exit(1);
}
qb_ipcs_poll_handlers_set(s1, &glib_ph);
qb_ipcs_run(s1);
rc = qb_ipcs_run(s1);
if (rc != 0) {
errno = -rc;
qb_perror(LOG_ERR, "qb_ipcs_run");
exit(1);
}

g_main_loop_run(glib_loop);
#else
Expand Down

0 comments on commit c533b24

Please sign in to comment.