From fd33289346881b96841a598a1f8980212b0bab62 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Thu, 30 May 2019 22:02:07 +0100 Subject: Remove most (all?) exit()s with error handling without exiting where possible. Convert most remaining printing to stdout/stderr to debugprint() instead. --- functions.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'functions.c') diff --git a/functions.c b/functions.c index 13b910b..dbcc54e 100644 --- a/functions.c +++ b/functions.c @@ -52,6 +52,7 @@ void updategreetingnick(char *greeting, char *greetingnum, char *newnick, char * char greetingtmp2[MAXDATASIZE]; if (!snprintf(greetingtmp2, MAXDATASIZE, "%s%s %s", greetingtmp, newnick, greeting + pos + strlen(oldnick) + 1)) { fprintf(stderr, "Error while preparing new greeting string!\n"); + debugprint(DEBUG_CRIT, "Error while preparing new greeting string!\n"); exit(1); } @@ -80,8 +81,7 @@ void debugprint(int level, char *format, ...) { int bytes = 0; fp = fopen(debugpath, "a"); if ((bytes = vfprintf(fp, format, args)) < 0) { - printf("error: could not write to debug file.\n"); - exit(1); + debugprint(DEBUG_CRIT, "error: could not write to debug file.\n"); } fclose(fp); -- cgit v1.2.3