diff options
author | Thomas Rast <trast@student.ethz.ch> | 2008-09-19 00:24:46 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-09-18 19:51:13 -0700 |
commit | e32c0a9c38a126c9eb8ff8f2fdc1fb8875400bbe (patch) | |
tree | 5802e0a8311bc0db1e8c6779447735079b58d8d8 | |
parent | Make git archive respect core.autocrlf when creating zip format archives (diff) | |
download | tgif-e32c0a9c38a126c9eb8ff8f2fdc1fb8875400bbe.tar.xz |
sha1_file: link() returns -1 on failure, not errno
5723fe7 (Avoid cross-directory renames and linking on object creation,
2008-06-14) changed the call to use link() directly instead of through a
custom wrapper, but forgot that it returns 0 or -1, not 0 or errno.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | sha1_file.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sha1_file.c b/sha1_file.c index 477d3fb4b0..e2cb342a32 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -2136,7 +2136,9 @@ static void write_sha1_file_prepare(const void *buf, unsigned long len, */ int move_temp_to_file(const char *tmpfile, const char *filename) { - int ret = link(tmpfile, filename); + int ret = 0; + if (link(tmpfile, filename)) + ret = errno; /* * Coda hack - coda doesn't like cross-directory links, |