From b595a19af6c78deb192a9b2a18a3e178e34890ff Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Thu, 14 Sep 2023 12:52:58 +0200 Subject: [PATCH] refactor fatal_exit() --- src/error_handling.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/error_handling.c b/src/error_handling.c index 0313d4e..e50a7eb 100644 --- a/src/error_handling.c +++ b/src/error_handling.c @@ -2,12 +2,10 @@ #include void fatal_exit( char* error, char* advice ) { - if ( error[ 0 ] == '\0' ) { - fprintf( stderr, "FATAL ERROR, exit.\n" ); - exit( 1 ); - } + fprintf( stderr, "FATAL ERROR, exit.\n" ); - fprintf( stderr, "FATAL ERROR, exit.\n - %s\n", error ); + if ( error[ 0 ] != '\0' ) + fprintf( stderr, " - %s\n", error ); if ( advice[ 0 ] != '\0' ) fprintf( stderr, " - %s\n", advice );