From: Alex Riesen Date: Fri, 18 May 2007 22:00:14 GMT Subject: Re: [PATCH 09/16] entry.c: optionally checkout submodules Message-ID: <20070518220014.GD10475@steel.home> In-Reply-To: <1179516307425-git-send-email-skimo@liacs.nl> skimo@liacs.nl, Fri, May 18, 2007 21:24:58 +0200: > + if (!getcwd(cwd, sizeof(cwd)) || cwd[0] != '/') > + die("Unable to read current working directory"); > + > + if (chdir(path)) > + die("Cannot move to '%s'", path); > + How about modifying run_command to chdir after fork? You'd save the hassle of save/restoring cwd and don't mess up process' context (which is always a good idea to preserve). The code'd be simplier, too.