static void dmtcpProcessFailedExec(const char *path, char *newArgv[]) { int saved_errno = errno; if (dmtcp::Util::isSetuid(path)) { dmtcp::Util::freePatchedArgv(newArgv); } restoreUserLDPRELOAD(); unsetenv(ENV_VAR_DLSYM_OFFSET); JTRACE ( "Processed failed Exec Attempt" ) (path) ( getenv( "LD_PRELOAD" ) ); errno = saved_errno; }
int main(int argc, char** argv) { if (getenv("LD_PRELOAD")) { restoreUserLDPRELOAD(); } if(argc==1){ fprintf(stderr, "USAGE: %s cmd ...\n", argv[0]); return 1; } size_t fd; for (fd = PROTECTED_FD_START; fd < PROTECTED_FD_END; fd++) { close(fd); } execvp(argv[1], argv+1); perror("execvp:"); return 2; }