From 3af92035d534a2a59531199b8c15e64568fd9d63 Mon Sep 17 00:00:00 2001 From: Michael Ortmann Date: Tue, 28 Nov 2023 01:02:54 +0100 Subject: [PATCH 1/3] Add error logging --- src/users.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/users.c b/src/users.c index e99f6f9c2..78db525c4 100644 --- a/src/users.c +++ b/src/users.c @@ -29,6 +29,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include + #include "main.h" #include "users.h" #include "chan.h" @@ -698,9 +700,10 @@ int readuserfile(char *file, struct userrec **ret) global_invites = NULL; } lasthand[0] = 0; - f = fopen(file, "r"); - if (f == NULL) + if (!(f = fopen(file, "r"))) { + debug2("users: fopen(%s): %s", file, strerror(errno)); return 0; + } noshare = noxtra = 1; /* read opening comment */ s = buf; From 9cbeae3141b31868d9801748ca202424c33a7b1e Mon Sep 17 00:00:00 2001 From: Michael Ortmann Date: Tue, 28 Nov 2023 01:12:47 +0100 Subject: [PATCH 2/3] Add more error logging --- src/mod/share.mod/share.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mod/share.mod/share.c b/src/mod/share.mod/share.c index 40452536a..ec650e9e1 100644 --- a/src/mod/share.mod/share.c +++ b/src/mod/share.mod/share.c @@ -26,6 +26,7 @@ #include "src/mod/module.h" +#include #include #include #include @@ -1244,9 +1245,11 @@ static void share_ufsend(int idx, char *par) zapfbot(idx); } else if (copy_to_tmp && !(f = tmpfile())) { putlog(LOG_MISC, "*", "CAN'T WRITE TEMPORARY USERFILE DOWNLOAD FILE!"); + debug1("share: tmpfile(): %s", strerror(errno)); zapfbot(idx); } else if (!copy_to_tmp && !(f = fopen(s, "wb"))) { putlog(LOG_MISC, "*", "CAN'T WRITE USERFILE DOWNLOAD FILE!"); + debug2("share: fopen(%s): %s", s, strerror(errno)); zapfbot(idx); } else { /* Ignore longip and use botaddr, arg kept for backward compat for pre 1.8.3 */ From 0073c081d47826763c0de9bbb1d1cea673376c7a Mon Sep 17 00:00:00 2001 From: Michael Ortmann Date: Tue, 28 Nov 2023 01:20:24 +0100 Subject: [PATCH 3/3] Cleanup includes --- src/users.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/users.c b/src/users.c index 78db525c4..041f2fe64 100644 --- a/src/users.c +++ b/src/users.c @@ -30,6 +30,8 @@ */ #include +#include +#include #include "main.h" #include "users.h" @@ -37,9 +39,6 @@ #include "modules.h" #include "tandem.h" -#include -#include - extern struct dcc_t *dcc; extern struct userrec *userlist, *lastuser; extern struct chanset_t *chanset;