Fix: lttng-ust-comm: wait on wrong child process
[lttng-ust.git] / src / lib / lttng-ust / lttng-ust-comm.c
index 0a039feffdb7f8d64085da19118b0fea3a886e42..7903550f5cfc32c599f46ba49e7f6f8d3327615d 100644 (file)
@@ -447,6 +447,8 @@ void lttng_ust_init_thread(void)
         * this thread attempts to use them.
         */
        lttng_ust_common_init_thread(LTTNG_UST_INIT_THREAD_MASK);
+
+       lttng_ust_urcu_register_thread();
 }
 
 int lttng_get_notify_socket(void *owner)
@@ -1582,14 +1584,14 @@ open_write:
        pid = fork();
        URCU_TLS(lttng_ust_nest_count)--;
        if (pid > 0) {
-               int status;
+               int status, wait_ret;
 
                /*
                 * Parent: wait for child to return, in which case the
                 * shared memory map will have been created.
                 */
-               pid = wait(&status);
-               if (pid < 0 || !WIFEXITED(status) || WEXITSTATUS(status) != 0) {
+               wait_ret = waitpid(pid, &status, 0);
+               if (wait_ret < 0 || !WIFEXITED(status) || WEXITSTATUS(status) != 0) {
                        wait_shm_fd = -1;
                        goto end;
                }
This page took 0.023871 seconds and 4 git commands to generate.