Re: [libvirt PATCH 28/31] tests: commandhelper: change how we detect if running as daemon

2020-07-02 Thread Ján Tomko

On a Thursday in 2020, Pavel Hrdina wrote:

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 
---
tests/commandhelper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



Reviewed-by: Ján Tomko 

Jano


signature.asc
Description: PGP signature


[libvirt PATCH 28/31] tests: commandhelper: change how we detect if running as daemon

2020-07-02 Thread Pavel Hrdina
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 
---
 tests/commandhelper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/commandhelper.c b/tests/commandhelper.c
index 3f040be8f22..4266e11902f 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") &&
-- 
2.26.2