{"thread":{"id":"2231","subject":"[PATCH 3/4] Work around missing hard links on FAT formatted media","startedAt":"2005-10-25T23:41:20Z","lastAt":"2005-10-25T23:41:20Z","messageCount":1,"participants":["Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"10627","messageId":"Pine.LNX.4.63.0510260140320.30576@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2231","inReplyTo":null,"subject":"[PATCH 3/4] Work around missing hard links on FAT formatted media","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-10-25T23:41:20Z","receivedAt":"2005-10-25T23:41:20Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"FAT -- like Coda -- does not like cross-directory hard links. To be \nprecise, FAT does not like links at all. But links are not needed either. \nSo get rid of them.\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\n---\n\n clone-pack.c |    2 +-\n sha1_file.c  |    5 ++++-\n 2 files changed, 5 insertions(+), 2 deletions(-)\n\napplies-to: 73c52ee93ee1d5441a4cb207287b3ba7b0d8f4ed\n8ffaffc904086970c66e5e8b7dd54001a1a2c466\ndiff --git a/clone-pack.c b/clone-pack.c\nindex 4f4975b..9609219 100644\n--- a/clone-pack.c\n+++ b/clone-pack.c\n@@ -211,7 +211,7 @@ static int clone_without_unpack(int fd[2\n \n \tifd = fd[0];\n \tsnprintf(tmpfile, sizeof(tmpfile),\n-\t\t \"%s/pack-XXXXXX\", get_object_directory());\n+\t\t \"%s/pack/tmp-XXXXXX\", get_object_directory());\n \tofd = mkstemp(tmpfile);\n \tif (ofd < 0)\n \t\treturn error(\"unable to create temporary file %s\", tmpfile);\ndiff --git a/sha1_file.c b/sha1_file.c\nindex e456799..7fdc469 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -1239,11 +1239,14 @@ int move_temp_to_file(const char *tmpfil\n \t\t * won't be able to check collisions, but that's not a\n \t\t * big deal.\n \t\t *\n+\t\t * The same holds for FAT formatted media.\n+\t\t *\n \t\t * When this succeeds, we just return 0. We have nothing\n \t\t * left to unlink.\n \t\t */\n-\t\tif (ret == EXDEV && !rename(tmpfile, filename))\n+\t\tif ((ret == EXDEV || ret == ENOTSUP) && !rename(tmpfile, filename))\n \t\t\treturn 0;\n+\t\tret = errno;\n \t}\n \tunlink(tmpfile);\n \tif (ret) {\n---\n0.99.8.GIT\n"}]}