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