X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fbin%2Flttng-sessiond%2Fmain.c;h=67ecc5228a194c7b6edda49431f0f20dcfa3ea16;hb=8db0dc005c98126fb0e6ede59a695e399ad31e01;hp=8aea0e77c840e38f3a05b117064fbc21f1f900e9;hpb=67676bd8b522e83c6d45c7f6a205ab7a30001c9d;p=lttng-tools.git 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); }