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

1 messages from 2005-10-25 to 2005-10-25. Participants: Johannes Schindelin.
Thread: https://gitlist.dev/t/2231

## Johannes Schindelin, 2005-10-25 23:41

Subject: [PATCH 3/4] Work around missing hard links on FAT formatted media
Message-ID: <Pine.LNX.4.63.0510260140320.30576@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0510260140320.30576%40wbgn013.biozentrum.uni-wuerzburg.de

```
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
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

```
