From 748279ece4769b0c0180c5cf14b91725ce448a3a Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Tue, 3 Sep 2002 12:03:23 +0000 Subject: [PATCH] Make file_err() not abort the current process; recover and keep going instead. This fixes a problem running OpenOffice on cachegrind. MERGE TO HEAD git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_1_0_BRANCH@860 --- vg_cachesim.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/vg_cachesim.c b/vg_cachesim.c index e0d09811ac..ec5686d1da 100644 --- a/vg_cachesim.c +++ b/vg_cachesim.c @@ -73,9 +73,10 @@ Int VG_(log2) ( Int x ) static void file_err() { VG_(message)(Vg_UserMsg, - "error: can't open cache simulation output file `%s'", - OUT_FILE ); - VG_(exit)(1); + "error: can't open cache simulation output file `%s'", + OUT_FILE ); + VG_(message)(Vg_UserMsg, + " ... so detailed simulation results will be missing."); } /*------------------------------------------------------------*/ @@ -1281,7 +1282,8 @@ void VG_(init_cachesim)(void) file_err(); } } - VG_(close)(fd); + if (-1 != fd) + VG_(close)(fd); initCC(&Ir_total); initCC(&Dr_total); @@ -1487,7 +1489,12 @@ static void fprint_BBCC_table_and_calc_totals(Int client_argc, VGP_PUSHCC(VgpCacheDump); fd = VG_(open_write)(OUT_FILE); - if (-1 == fd) { file_err(); } + if (-1 == fd) { + /* If the file can't be opened for whatever reason (conflict + between multiple cachegrinded processes?), give up now. */ + file_err(); + return; + } /* "desc:" lines (giving I1/D1/L2 cache configuration) */ VG_(sprintf)(buf, "desc: I1 cache: %s\n", I1.desc_line); -- 2.47.2