All pastes #207548 Raw Edit

Unnamed

public text v1 · immutable
#207548 ·published 2006-10-18 02:07 UTC
rendered paste body
int x = 0;
int myPID;
myPID = fork();
if (!myPID)
{
	execv(argv[0], argv);
	goto ohno;
} 
else
{
	wait (NULL);
}
ohno:
if (!myPID)
{
        x = 1;
}

// the value of x here is 0, even if execv() fails, in which case i want this value of x to be 1