From 0c68d386da710940a22712b8f3539f7e73ba1b8f Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Wed, 27 Aug 2008 12:48:00 -0700 Subject: index-pack: be careful after fixing up the header/footer The index-pack command, when processing a thin pack, fixed up the pack after-the-fact. It forgets to fsync the result, because it only did that in one path rather in all cases of fixup. This moves the fsync_or_die() to the fix-up routine itself, rather than doing it in one of the callers, so that all cases are covered. Signed-off-by: Linus Torvalds Signed-off-by: Junio C Hamano --- builtin-pack-objects.c | 1 - pack-write.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c index 2dadec1630..d394c494a5 100644 --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c @@ -499,7 +499,6 @@ static void write_pack_file(void) } else { int fd = sha1close(f, NULL, 0); fixup_pack_header_footer(fd, sha1, pack_tmp_name, nr_written); - fsync_or_die(fd, pack_tmp_name); close(fd); } diff --git a/pack-write.c b/pack-write.c index a8f0269936..ddcfd37af2 100644 --- a/pack-write.c +++ b/pack-write.c @@ -179,6 +179,7 @@ void fixup_pack_header_footer(int pack_fd, SHA1_Final(pack_file_sha1, &c); write_or_die(pack_fd, pack_file_sha1, 20); + fsync_or_die(pack_fd, pack_name); } char *index_pack_lockfile(int ip_out) -- cgit v1.2.3 From c67b1fa349cc7b4341b32b9ef1c58a3821ce0830 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 27 Aug 2008 16:14:22 -0700 Subject: ctype.c: protect tiny C preprocessor constants Some platforms contaminate the preprocessor token namespace with their own definition of SS without being asked. Avoid getting hit by redefinition warning messages by explicitly undef SS, AA and DD shorthand we use in this table definition. Signed-off-by: Junio C Hamano --- ctype.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ctype.c b/ctype.c index ee06eb7f48..d2bd38e901 100644 --- a/ctype.c +++ b/ctype.c @@ -5,6 +5,11 @@ */ #include "cache.h" +/* Just so that no insane platform contaminate namespace with these symbols */ +#undef SS +#undef AA +#undef DD + #define SS GIT_SPACE #define AA GIT_ALPHA #define DD GIT_DIGIT -- cgit v1.2.3