@matheusbsbs / matheus-bagliano / commits / 22c9f7e4c5
Fork 0

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>

Shawn O. Pearce committed Feb 7, 2007 at 02:46 UTC 22c9f7e4c5b1d14868de413b70d26b9b0670078f
1 file changed +6 -2
fast-import.c
+6 -2
@@ -1367,8 +1367,12 @@ static void dump_marks(void)
1367 if (mark_file)
1368 {
1369 FILE *f = fopen(mark_file, "w");
1370 - dump_marks_helper(f, 0, marks);
1371 - fclose(f);
1370 + if (f) {
1371 + dump_marks_helper(f, 0, marks);
1372 + fclose(f);
1373 + } else
1374 + failure |= error("Unable to write marks file %s: %s",
1375 + mark_file, strerror(errno));
1376 }
1377 }
1378