Merge branch 'maint'

* maint:
  tutorial: gentler illustration of Alice/Bob workflow using gitk
  pretty=format: respect date format options
  make git-shell paranoid about closed stdin/stdout/stderr
  Document gitk --argscmd flag.
  Fix '--dirstat' with cross-directory renaming
  for-each-ref: Allow a trailing slash in the patterns
This commit is contained in:
Junio C Hamano
2008-08-29 00:16:39 -07:00
11 changed files with 80 additions and 12 deletions

13
shell.c
View File

@ -48,6 +48,19 @@ int main(int argc, char **argv)
{
char *prog;
struct commands *cmd;
int devnull_fd;
/*
* Always open file descriptors 0/1/2 to avoid clobbering files
* in die(). It also avoids not messing up when the pipes are
* dup'ed onto stdin/stdout/stderr in the child processes we spawn.
*/
devnull_fd = open("/dev/null", O_RDWR);
while (devnull_fd >= 0 && devnull_fd <= 2)
devnull_fd = dup(devnull_fd);
if (devnull_fd == -1)
die("opening /dev/null failed (%s)", strerror(errno));
close (devnull_fd);
/*
* Special hack to pretend to be a CVS server