
#include "V.h"
/*
* Wrapper for the execv() system call.  Note that we close  extraneous  files.
* This  might  be  a  significant change in functionality, if your application
* opens other files and passes them to subprocesses.
*/
d_execv(name,argv)
	char *name;
	char**argv;
{	int  i, r;
	if (Vlvl > 4) {
		P2 "%s execv(\"%s\",%08X)",Vtime(),name,argv D;
		dumpv(argv,"argv");
		dumpv(environ,"environ");
	}
	for (i=3; i<=openfilemax; i++)
		if (i != Fileno(Vout))
			Close(i);
	errno = 0;
	V6 "execv(\"%s\") ...",name D;
	r = execv(name,argv);
	V6 "execv(\"%s\")=%d	[Err %d=%s=%s]",name,r,Errinfo D;
	return r;
}
