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

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

Attachment: signature.asc
Description: This is a digitally signed message part.


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