Re: [PATCH 09/16] entry.c: optionally checkout submodules
- From
Alex Riesen <raa.lkml@gmail.com>
- Date
- May 18, 2007, 22:00 UTC
- 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:
Show 6 quoted lines
> + 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.