X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=liblttng-ust%2Flttng-ust-comm.c;h=1c022ef139f142d9ecc1a91bb625ffbcf9ca98e9;hb=bee355bbdd590902e6f065bf50d56ac83e36677a;hp=f08e7b0698a83e1834c3c6dea2e2badb81b22bb0;hpb=4df30a16a895d8c9e83dcf0935fc21a1626a658f;p=lttng-ust.git diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index f08e7b06..1c022ef1 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -1514,7 +1514,9 @@ void __attribute__((constructor)) lttng_ust_init(void) timeout_mode = get_constructor_timeout(&constructor_timeout); ret = sem_init(&constructor_wait, 0, 0); - assert(!ret); + if (ret) { + PERROR("sem_init"); + } ret = setup_local_apps(); if (ret) { @@ -1579,17 +1581,34 @@ void __attribute__((constructor)) lttng_ust_init(void) ret = sem_timedwait(&constructor_wait, &constructor_timeout); } while (ret < 0 && errno == EINTR); - if (ret < 0 && errno == ETIMEDOUT) { - ERR("Timed out waiting for lttng-sessiond"); - } else { - assert(!ret); + if (ret < 0) { + switch (errno) { + case ETIMEDOUT: + ERR("Timed out waiting for lttng-sessiond"); + break; + case EINVAL: + PERROR("sem_timedwait"); + break; + default: + ERR("Unexpected error \"%s\" returned by sem_timedwait", + strerror(errno)); + } } break; case -1:/* wait forever */ do { ret = sem_wait(&constructor_wait); } while (ret < 0 && errno == EINTR); - assert(!ret); + if (ret < 0) { + switch (errno) { + case EINVAL: + PERROR("sem_wait"); + break; + default: + ERR("Unexpected error \"%s\" returned by sem_wait", + strerror(errno)); + } + } break; case 0: /* no timeout */ break;