From 7b58f85a7fa749a3dab64976402e7e57cd57d7b0 Mon Sep 17 00:00:00 2001 From: fosslinux Date: Sun, 29 Mar 2020 19:46:10 +1100 Subject: [PATCH] Make description in die() appears everywhere Before it only appeared in syslog. Make the error more obvious to the admin, so that it appears on the page as well, and helps with debugging. Closes #32. Yes, I am still alive, have just been busy. --- src/gophernicus.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gophernicus.c b/src/gophernicus.c index 1b6efb8..64a05f3 100644 --- a/src/gophernicus.c +++ b/src/gophernicus.c @@ -120,14 +120,14 @@ void die(state *st, char *message, char *description) /* Log the error */ if (st->opt_syslog) { - syslog(LOG_ERR, "error \"%s\" for request \"%s\" from %s", - description, st->req_selector, st->req_remote_addr); + syslog(LOG_ERR, "error \"%s %s\" for request \"%s\" from %s", + message, description, st->req_selector, st->req_remote_addr); } log_combined(st, HTTP_404); /* Handle menu errors */ if (st->req_filetype == TYPE_MENU || st->req_filetype == TYPE_QUERY) { - printf("3" ERROR_PREFIX "%s\tTITLE\t" DUMMY_HOST CRLF, message); + printf("3" ERROR_PREFIX "%s %s\tTITLE\t" DUMMY_HOST CRLF, message, description); footer(st); } @@ -141,17 +141,17 @@ void die(state *st, char *message, char *description) printf("\n" "\n\n" " \n" - " " ERROR_PREFIX "%1$s\n" + " " ERROR_PREFIX "%1$s %2$s\n" "\n\n" - "" ERROR_PREFIX "%1$s\n" - "
\n", message);
+			"" ERROR_PREFIX "%1$s %2$s\n"
+			"
", message, description);
 		footer(st);
 		printf("
\n\n\n"); } /* Use plain text error for other filetypes */ else { - printf(ERROR_PREFIX "%s" CRLF, message); + printf(ERROR_PREFIX "%s %s" CRLF, message, description); footer(st); }