summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-02-07 07:46:35 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-02-07 07:46:35 (GMT)
commit22c9f7e4c5b1d14868de413b70d26b9b0670078f (patch)
tree6516a475a635c9f90d1f6400fc2d487514b9a87f /fast-import.c
parent820b9310127afe3533bb57034d6f458f5aed3e7e (diff)
downloadgit-22c9f7e4c5b1d14868de413b70d26b9b0670078f.zip
git-22c9f7e4c5b1d14868de413b70d26b9b0670078f.tar.gz
git-22c9f7e4c5b1d14868de413b70d26b9b0670078f.tar.bz2
Don't crash fast-import if the marks cannot be exported.
Apparently fast-import used to die a horrible death if we were unable to open the marks file for output. This is slightly less than ideal, especially now that we dump the marks as part of the `checkpoint` command. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fast-import.c b/fast-import.c
index d9ed3e2..face9bb 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1367,8 +1367,12 @@ static void dump_marks(void)
if (mark_file)
{
FILE *f = fopen(mark_file, "w");
- dump_marks_helper(f, 0, marks);
- fclose(f);
+ if (f) {
+ dump_marks_helper(f, 0, marks);
+ fclose(f);
+ } else
+ failure |= error("Unable to write marks file %s: %s",
+ mark_file, strerror(errno));
}
}