Re: [libvirt] [PATCH 10/21] Don't let parent of daemon exit until basic initialization is done

Hi, I'm not a C expert, but I see there is a use of an unitialized variable: default: { int got, exitstatus = 0; int ret; char status; close(statuspipe[1]); /* We wait to make sure the first child forked successfully */ if ((got = waitpid(pid, &exitstatus, 0)) < 0 || got != pid || status != 0) { <<< here return -1; } That explains the issue described by Guido, because he uses an i386 system. It was impossible for me to reproduce the issue because I use an amd64 system. char test; if (test == 0) puts("ok"); else puts("ko"); produces: - "ok" on amd64 system - "ko" on i386 system If I use the exitstatus variable in the test it seems to work great on both architectures. -- Laurent Léonard

On Sat, Oct 31, 2009 at 02:29:42PM +0100, Laurent L?onard wrote:
Hi,
I'm not a C expert, but I see there is a use of an unitialized variable:
default: { int got, exitstatus = 0; int ret; char status;
close(statuspipe[1]);
/* We wait to make sure the first child forked successfully */ if ((got = waitpid(pid, &exitstatus, 0)) < 0 || got != pid || status != 0) { <<< here return -1; }
That explains the issue described by Guido, because he uses an i386 system. It was impossible for me to reproduce the issue because I use an amd64 system.
Ahh, nicely spotted! I'll fix this Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
participants (2)
-
Daniel P. Berrange
-
Laurent Léonard