From: Pavel Hrdina Date: Wed, 27 May 2020 11:37:54 +0000 (+0200) Subject: tests: commandhelper: change how we detect if running as daemon X-Git-Tag: v6.6.0-rc1~170 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=966a0a75cc2300430eb398f292e2837a05a3fcda;p=thirdparty%2Flibvirt.git tests: commandhelper: change how we detect if running as daemon The old code works correctly with make and running directly from shell but it failed with Meson test suite where session ID and process group are the same in both cases. What changes in both cases is parent process ID so use that instead of session ID. Signed-off-by: Pavel Hrdina Reviewed-by: Ján Tomko Reviewed-by: Michal Privoznik --- diff --git a/tests/commandhelper.c b/tests/commandhelper.c index 3f040be8f2..4266e11902 100644 --- a/tests/commandhelper.c +++ b/tests/commandhelper.c @@ -126,7 +126,7 @@ int main(int argc, char **argv) { fprintf(log, "FD:%zu\n", i); } - fprintf(log, "DAEMON:%s\n", getpgrp() == getsid(0) ? "yes" : "no"); + fprintf(log, "DAEMON:%s\n", getpgrp() != getppid() ? "yes" : "no"); if (!(cwd = getcwd(NULL, 0))) goto cleanup; if (strlen(cwd) > strlen(".../commanddata") &&