Work around missing hard links on FAT formatted media
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> Signed-off-by: Junio C Hamano <junkio@cox.net>
Johannes Schindelin committed
Oct 26, 2005 at 01:41 UTC
9e48b389990c0201487e58f3bac32734a59a7e89
2 files changed
+5
-2
clone-pack.c
+1
-1
@@ -211,7 +211,7 @@ static int clone_without_unpack(int fd[2])
211
212
ifd = fd[0];
213
snprintf(tmpfile, sizeof(tmpfile),
214
- "%s/pack-XXXXXX", get_object_directory());
214
+ "%s/pack/tmp-XXXXXX", get_object_directory());
215
ofd = mkstemp(tmpfile);
216
if (ofd < 0)
217
return error("unable to create temporary file %s", tmpfile);
sha1_file.c
+4
-1
@@ -1239,11 +1239,14 @@ int move_temp_to_file(const char *tmpfile, char *filename)
1239
* won't be able to check collisions, but that's not a
1240
* big deal.
1241
*
1242
+ * The same holds for FAT formatted media.
1243
+ *
1244
* When this succeeds, we just return 0. We have nothing
1245
* left to unlink.
1246
*/
1245
- if (ret == EXDEV && !rename(tmpfile, filename))
1247
+ if ((ret == EXDEV || ret == ENOTSUP) && !rename(tmpfile, filename))
1248
return 0;
1249
+ ret = errno;
1250
}
1251
unlink(tmpfile);
1252
if (ret) {