From ea586826be1bd0012556e10a9fa53e912cef6896 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Fri, 3 Aug 2018 09:22:17 +0200 Subject: [PATCH] Flip logic to simplify code a bit Signed-off-by: Joachim Nilsson --- src/ksym.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/src/ksym.c b/src/ksym.c index 761eabe..bd48084 100644 --- a/src/ksym.c +++ b/src/ksym.c @@ -210,34 +210,24 @@ extern int InitKsyms(mapfile) /* * Search for and open the file containing the kernel symbols. */ - if ( mapfile != (char *) 0 ) - { - if ( (sym_file = fopen(mapfile, "r")) == (FILE *) 0 ) - { - Syslog(LOG_WARNING, "Cannot open map file: %s.", \ - mapfile); - return(0); - } - } - else + if ( mapfile == (char *) 0 ) { if ( (mapfile = FindSymbolFile()) == (char *) 0 ) { - Syslog(LOG_WARNING, "Cannot find map file."); + Syslog(LOG_WARNING, "Cannot find a map file."); if ( debugging ) - fputs("Cannot find map file.\n", stderr); - return(0); - } - - if ( (sym_file = fopen(mapfile, "r")) == (FILE *) 0 ) - { - Syslog(LOG_WARNING, "Cannot open map file."); - if ( debugging ) - fputs("Cannot open map file.\n", stderr); + fputs("Cannot find a map file.\n", stderr); return(0); } } + if ( (sym_file = fopen(mapfile, "r")) == (FILE *) 0 ) + { + Syslog(LOG_WARNING, "Cannot open map file: %s.", mapfile); + if ( debugging ) + fprintf(stderr, "Cannot open map file: %s.\n", mapfile); + return(0); + } /* * Read the kernel symbol table file and add entries for each