* [PATCH] sha1_file: link() returns -1 on failure, not errno
@ 2008-09-18 22:24 Thomas Rast
0 siblings, 0 replies; only message in thread
From: Thomas Rast @ 2008-09-18 22:24 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
5723fe7 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>
---
sha1_file.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/sha1_file.c b/sha1_file.c
index 9ee1ed1..aec81bb 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,
--
tg: (97d7fee..) t/link-returns-minus1 (depends on: origin/master)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-09-18 22:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-18 22:24 [PATCH] sha1_file: link() returns -1 on failure, not errno Thomas Rast
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox