From 8ccb7c66a1d13e62df57dfd70b0836eece92e5b7 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sat, 25 Apr 2026 17:12:32 +0200 Subject: Log fclose() errors --- FICS/command.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'FICS') diff --git a/FICS/command.c b/FICS/command.c index 63a08f3..78ebfe8 100644 --- a/FICS/command.c +++ b/FICS/command.c @@ -784,7 +784,10 @@ check_news(int p, int admin) if (num_anews == -1) { num_anews = count_lines(fp); - fclose(fp); + + if (fclose(fp) != 0) + warn("%s: error: fclose", __func__); + if ((fp = fopen(filename, "r")) == NULL) { warn("%s: can't find admin news index (%s)", __func__, filename); @@ -807,7 +810,8 @@ check_news(int p, int admin) if ((crtime - lc) < 0) { pprintf(p, "There are no new admin news items since " "your last login.\n\n"); - fclose(fp); + if (fclose(fp) != 0) + warn("%s: error: fclose", __func__); return; } else { pprintf(p, "Index of new admin news items:\n"); @@ -834,7 +838,10 @@ check_news(int p, int admin) if (num_news == -1) { num_news = count_lines(fp); - fclose(fp); + + if (fclose(fp) != 0) + warn("%s: error: fclose", __func__); + if ((fp = fopen(filename, "r")) == NULL) { warn("%s: can't find news index (%s)", __func__, filename); @@ -857,7 +864,8 @@ check_news(int p, int admin) if ((crtime - lc) < 0) { pprintf(p, "There are no new news items since your " "last login (%s).\n", strltime(&lc)); - fclose(fp); + if (fclose(fp) != 0) + warn("%s: error: fclose", __func__); return; } else { pprintf(p, "Index of new news items:\n"); @@ -874,7 +882,8 @@ check_news(int p, int admin) } } - fclose(fp); + if (fclose(fp) != 0) + warn("%s: error: fclose", __func__); } PRIVATE int -- cgit v1.2.3