Re: [PATCHv2 4/7] tests: avoid data race

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2010/12/18 Eric Blake <eblake@xxxxxxxxxx>:
> 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.
> ---
> Âtests/commandhelper.c | Â Â2 +-
> Â1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/tests/commandhelper.c b/tests/commandhelper.c
> index 5b2f301..f400e8d 100644
> --- a/tests/commandhelper.c
> +++ b/tests/commandhelper.c
> @@ -95,7 +95,7 @@ int main(int argc, char **argv) {
> Â Â Â Â Â Â 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;
> --
>

ACK.

Matthias

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]