I got some spurious failures when commandhelper won the race and
ran to the point of parent detection prior to the intermediate
daemonizing process getting a chance to exit. This fixes it.
* tests/commandhelper.c (main): Checking for re-parenting to
init(1) is racy; instead check that we belong to a new session.
fprintf(log, "FD:%d\n", i);
}
- fprintf(log, "DAEMON:%s\n", getppid() == 1 ? "yes" : "no");
+ fprintf(log, "DAEMON:%s\n", getpgrp() == getsid(0) ? "yes" : "no");
char cwd[1024];
if (!getcwd(cwd, sizeof(cwd)))
return EXIT_FAILURE;