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