X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fmain.c;h=67ecc5228a194c7b6edda49431f0f20dcfa3ea16;hp=8aea0e77c840e38f3a05b117064fbc21f1f900e9;hb=077df0b372f77833c1de2dd9f534dec9e75696de;hpb=dd2c2a1b8ad6c0fb516f7e7c1bf1adfa6b93b8e6 diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 8aea0e77c..67ecc5228 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -4580,6 +4580,18 @@ static int daemonize(void) * user. */ while (!CMM_LOAD_SHARED(recv_child_signal)) { + int status; + pid_t ret; + + /* + * Check if child exists without blocking. If so, we have to stop + * this parent process and return an error. + */ + ret = waitpid(pid, &status, WNOHANG); + if (ret < 0 || (ret != 0 && WIFEXITED(status))) { + /* The child exited somehow or was not valid. */ + goto error; + } sleep(1); }