[PATCH 3/4] Work around missing hard links on FAT formatted media
From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:42:09
Subsystem:
the rest · Maintainer:
Linus Torvalds
FAT -- like Coda -- does not like cross-directory hard links. To be precise, FAT does not like links at all. But links are not needed either. So get rid of them. Signed-off-by: Johannes Schindelin <redacted> --- clone-pack.c | 2 +- sha1_file.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) applies-to: 73c52ee93ee1d5441a4cb207287b3ba7b0d8f4ed 8ffaffc904086970c66e5e8b7dd54001a1a2c466
diff --git a/clone-pack.c b/clone-pack.c
index 4f4975b..9609219 100644
--- a/clone-pack.c
+++ b/clone-pack.c@@ -211,7 +211,7 @@ static int clone_without_unpack(int fd[2 ifd = fd[0]; snprintf(tmpfile, sizeof(tmpfile), - "%s/pack-XXXXXX", get_object_directory()); + "%s/pack/tmp-XXXXXX", get_object_directory()); ofd = mkstemp(tmpfile); if (ofd < 0) return error("unable to create temporary file %s", tmpfile);
diff --git a/sha1_file.c b/sha1_file.c
index e456799..7fdc469 100644
--- a/sha1_file.c
+++ b/sha1_file.c@@ -1239,11 +1239,14 @@ int move_temp_to_file(const char *tmpfil * won't be able to check collisions, but that's not a * big deal. * + * The same holds for FAT formatted media. + * * When this succeeds, we just return 0. We have nothing * left to unlink. */ - if (ret == EXDEV && !rename(tmpfile, filename)) + if ((ret == EXDEV || ret == ENOTSUP) && !rename(tmpfile, filename)) return 0; + ret = errno; } unlink(tmpfile); if (ret) {
--- 0.99.8.GIT