threads / patch / 2231

patch, 4 partsWork around missing hard links on FAT formatted media

Subject: [PATCH 3/4] Work around missing hard links on FAT formatted media

## tl;dr

One message between Oct 25, 2005 and Oct 25, 2005. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Johannes Schindelin· Oct 25, 2005, 23:41 UTC · lore

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 <Johannes.Schindelin@gmx.de>
---
 clone-pack.c |    2 +-
 sha1_file.c  |    5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

applies-to: 73c52ee93ee1d5441a4cb207287b3ba7b0d8f4ed 8ffaffc904086970c66e5e8b7dd54001a1a2c466

Show changes to 2 files +5 −2

clone-pack.c, sha1_file.c

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

← back to recent threads