All pastes #207556 Raw Edit

Miscellany

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

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