Skip to content

Commit

Permalink
Make chdir failures visible
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Alex Riesen authored and Junio C Hamano committed Dec 5, 2008
1 parent 47d32af commit 7be77de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions git.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ static int handle_alias(int *argcp, const char ***argv)
ret = 1;
}

if (subdir)
chdir(subdir);
if (subdir && chdir(subdir))
die("Cannot change to %s: %s", subdir, strerror(errno));

errno = saved_errno;

Expand Down
3 changes: 2 additions & 1 deletion setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,8 @@ const char *setup_git_directory_gently(int *nongit_ok)
}
die("Not a git repository");
}
chdir("..");
if (chdir(".."))
die("Cannot change to %s/..: %s", cwd, strerror(errno));
}

inside_git_dir = 0;
Expand Down

0 comments on commit 7be77de

Please sign in to comment.