Skip to content

Commit c21e2a1

Browse files
committed
1 parent 77755b6 commit c21e2a1

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

contrib/bzip2/bzip2.c

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -829,10 +829,9 @@ void mySignalCatcher ( IntNative n )
829829
static
830830
void mySIGSEGVorSIGBUScatcher ( IntNative n )
831831
{
832+
const char *msg;
832833
if (opMode == OM_Z)
833-
fprintf (
834-
stderr,
835-
"\n%s: Caught a SIGSEGV or SIGBUS whilst compressing.\n"
834+
msg = ": Caught a SIGSEGV or SIGBUS whilst compressing.\n"
836835
"\n"
837836
" Possible causes are (most likely first):\n"
838837
" (1) This computer has unreliable memory or cache hardware\n"
@@ -848,12 +847,9 @@ void mySIGSEGVorSIGBUScatcher ( IntNative n )
848847
" bug report should have. If the manual is available on your\n"
849848
" system, please try and read it before mailing me. If you don't\n"
850849
" have the manual or can't be bothered to read it, mail me anyway.\n"
851-
"\n",
852-
progName );
853-
else
854-
fprintf (
855-
stderr,
856-
"\n%s: Caught a SIGSEGV or SIGBUS whilst decompressing.\n"
850+
"\n";
851+
else
852+
msg = ": Caught a SIGSEGV or SIGBUS whilst decompressing.\n"
857853
"\n"
858854
" Possible causes are (most likely first):\n"
859855
" (1) The compressed data is corrupted, and bzip2's usual checks\n"
@@ -871,13 +867,25 @@ void mySIGSEGVorSIGBUScatcher ( IntNative n )
871867
" bug report should have. If the manual is available on your\n"
872868
" system, please try and read it before mailing me. If you don't\n"
873869
" have the manual or can't be bothered to read it, mail me anyway.\n"
874-
"\n",
875-
progName );
876-
877-
showFileNames();
878-
if (opMode == OM_Z)
879-
cleanUpAndFail( 3 ); else
880-
{ cadvise(); cleanUpAndFail( 2 ); }
870+
"\n";
871+
write ( STDERR_FILENO, "\n", 1 );
872+
write ( STDERR_FILENO, progName, strlen ( progName ) );
873+
write ( STDERR_FILENO, msg, strlen ( msg ) );
874+
875+
msg = "\tInput file = ";
876+
write ( STDERR_FILENO, msg, strlen (msg) );
877+
write ( STDERR_FILENO, inName, strlen (inName) );
878+
write ( STDERR_FILENO, "\n", 1 );
879+
msg = "\tOutput file = ";
880+
write ( STDERR_FILENO, msg, strlen (msg) );
881+
write ( STDERR_FILENO, outName, strlen (outName) );
882+
write ( STDERR_FILENO, "\n", 1 );
883+
884+
/* Don't call cleanupAndFail. If we ended up here something went
885+
terribly wrong. Trying to clean up might fail spectacularly. */
886+
887+
if (opMode == OM_Z) setExit(3); else setExit(2);
888+
_exit(exitValue);
881889
}
882890

883891

0 commit comments

Comments
 (0)