From dab8261e7d40378e33eaaa762b171fd66fc90db7 Mon Sep 17 00:00:00 2001 From: Michael Ortmann <41313082+michaelortmann@users.noreply.github.com> Date: Sat, 21 Jan 2023 18:53:27 +0100 Subject: [PATCH 1/9] Initial commit --- src/eggdrop.h | 8 ----- src/main.c | 91 ++++++++++++------------------------------------ src/mod/module.h | 12 ++----- src/modules.c | 12 ++----- src/net.c | 16 +++++++-- src/proto.h | 2 -- src/tclhash.c | 24 ++++--------- 7 files changed, 45 insertions(+), 120 deletions(-) diff --git a/src/eggdrop.h b/src/eggdrop.h index b1933dabe..70f9262c9 100644 --- a/src/eggdrop.h +++ b/src/eggdrop.h @@ -274,14 +274,6 @@ #define nrealloc(x,y) n_realloc((x),(y),__FILE__,__LINE__) #define nfree(x) n_free((x),__FILE__,__LINE__) -#ifdef DEBUG_CONTEXT -# define Context eggContext(__FILE__, __LINE__, NULL) -# define ContextNote(note) eggContextNote(__FILE__, __LINE__, NULL, note) -#else -# define Context do {} while (0) -# define ContextNote(note) do {} while (0) -#endif - #ifdef DEBUG_ASSERT # define Assert(expr) do { \ if (!(expr)) \ diff --git a/src/main.c b/src/main.c index 7fff6c6fe..0851cd358 100644 --- a/src/main.c +++ b/src/main.c @@ -30,7 +30,7 @@ */ /* We need config.h for CYGWIN_HACKS, but windows.h must be included before - * eggdrop headers, because the malloc/free/Context macros break the inclusion. + * eggdrop headers, because the malloc/free macros break the inclusion. * The SSL undefs are a workaround for bug #2182 in openssl with msys/mingw. */ #include @@ -171,11 +171,8 @@ unsigned long itraffic_unknown = 0; unsigned long itraffic_unknown_today = 0; #ifdef DEBUG_CONTEXT -/* Context storage for fatal crashes */ -char cx_file[16][32]; -char cx_note[16][256]; -int cx_line[16]; -int cx_ptr = 0; +extern char last_server_read[]; +extern char last_bind_called[]; #endif #ifdef TLS @@ -261,32 +258,25 @@ static void write_debug() { int x; char s[25]; - int y; if (nested_debug) { /* Yoicks, if we have this there's serious trouble! * All of these are pretty reliable, so we'll try these. - * - * NOTE: don't try and display context-notes in here, it's - * _not_ safe */ x = creat("DEBUG.DEBUG", 0644); if (x >= 0) { setsock(x, SOCK_NONSOCK); strlcpy(s, ctime(&now), sizeof s); - dprintf(-x, "Debug (%s) written %s\n", ver, s); - dprintf(-x, "Please report problem to bugs@eggheads.org\n"); - dprintf(-x, "after a visit to http://www.eggheads.org/bugzilla/\n"); + dprintf(-x, "Debug (%s) written %s\n" + "Please REPORT this BUG!\n" + "Check doc/BUG-REPORT on how to do so.", ver, s); #ifdef EGG_PATCH dprintf(-x, "Patch level: %s\n", EGG_PATCH); #else dprintf(-x, "Patch level: %s\n", "stable"); #endif - dprintf(-x, "Context: "); - cx_ptr = cx_ptr & 15; - for (y = ((cx_ptr + 1) & 15); y != cx_ptr; y = ((y + 1) & 15)) - dprintf(-x, "%s/%d,\n ", cx_file[y], cx_line[y]); - dprintf(-x, "%s/%d\n\n", cx_file[y], cx_line[y]); + dprintf(-x, "* last server read: %s\n" + "* last bind called: %s", last_server_read, last_bind_called); killsock(x); close(x); } @@ -295,10 +285,11 @@ static void write_debug() * have caused the fault last time. */ } else nested_debug = 1; - putlog(LOG_MISC, "*", "* Last context: %s/%d [%s]", cx_file[cx_ptr], - cx_line[cx_ptr], cx_note[cx_ptr][0] ? cx_note[cx_ptr] : ""); - putlog(LOG_MISC, "*", "* Please REPORT this BUG!"); - putlog(LOG_MISC, "*", "* Check doc/BUG-REPORT on how to do so."); + putlog(LOG_MISC, "*", "* Please REPORT this BUG!\n" + "* Check doc/BUG-REPORT on how to do so.\n" + "* last server read: %s\n" + "* last bind called: %s", last_server_read, + last_bind_called); x = creat("DEBUG", 0644); setsock(x, SOCK_NONSOCK); if (x < 0) { @@ -354,14 +345,10 @@ static void write_debug() #ifdef STRIPFLAGS dprintf(-x, "Strip flags: %s\n", STRIPFLAGS); #endif - - dprintf(-x, "Context: "); - cx_ptr = cx_ptr & 15; - for (y = ((cx_ptr + 1) & 15); y != cx_ptr; y = ((y + 1) & 15)) - dprintf(-x, "%s/%d, [%s]\n ", cx_file[y], cx_line[y], - (cx_note[y][0]) ? cx_note[y] : ""); - dprintf(-x, "%s/%d [%s]\n\n", cx_file[cx_ptr], cx_line[cx_ptr], - (cx_note[cx_ptr][0]) ? cx_note[cx_ptr] : ""); + dprintf(-x, "* Please REPORT this BUG!\n" + "* Check doc/BUG-REPORT on how to do so.\n" + "* last server read: %s\n" + "* last bind called: %s", last_server_read, last_bind_called); tell_dcc(-x); dprintf(-x, "\n"); debug_mem_to_dcc(-x); @@ -446,40 +433,14 @@ static void got_ill(int z) { check_tcl_signal("sigill"); #ifdef DEBUG_CONTEXT - putlog(LOG_MISC, "*", "* Context: %s/%d [%s]", cx_file[cx_ptr], - cx_line[cx_ptr], (cx_note[cx_ptr][0]) ? cx_note[cx_ptr] : ""); + putlog(LOG_MISC, "*", "* Please REPORT this BUG!\n" + "* Check doc/BUG-REPORT on how to do so.\n" + "* last server read: %s\n" + "* last bind called: %s", last_server_read, + last_bind_called); #endif } -#ifdef DEBUG_CONTEXT -/* Called from the Context macro. - */ -void eggContext(const char *file, int line, const char *module) -{ - eggContextNote(file, line, module, NULL); -} - -/* Called from the ContextNote macro. - */ -void eggContextNote(const char *file, int line, const char *module, - const char *note) -{ - char *p; - - p = strrchr(file, '/'); - cx_ptr = ((cx_ptr + 1) & 15); - if (!module) - strlcpy(cx_file[cx_ptr], p ? p + 1 : file, sizeof cx_file[cx_ptr]); - else - snprintf(cx_file[cx_ptr], sizeof cx_file[cx_ptr], "%s:%s", module, p ? p + 1 : file); - cx_line[cx_ptr] = line; - if (!note) - cx_note[cx_ptr][0] = 0; - else - strlcpy(cx_note[cx_ptr], note, sizeof cx_note[cx_ptr]); -} -#endif /* DEBUG_CONTEXT */ - #ifdef DEBUG_ASSERT /* Called from the Assert macro. */ @@ -611,8 +572,6 @@ static time_t then; static struct tm nowtm; /* Called once a second. - * - * Note: Try to not put any Context lines in here (guppy 21Mar2000). */ static void core_secondly() { @@ -1037,12 +996,6 @@ int main(int arg_c, char **arg_v) setrlimit(RLIMIT_CORE, &cdlim); #endif -#ifdef DEBUG_CONTEXT - /* Initialise context list */ - for (i = 0; i < 16; i++) - Context; -#endif - argc = arg_c; argv = arg_v; diff --git a/src/mod/module.h b/src/mod/module.h index 952c8b796..82d1bdd4f 100644 --- a/src/mod/module.h +++ b/src/mod/module.h @@ -90,11 +90,7 @@ typedef void (*chanout_butfunc)(int, int, const char *, ...) ATTRIBUTE_FORMAT(pr /* 0 - 3 */ #define nmalloc(x) (((void *(*)())global[0])((x),MODULE_NAME,__FILE__,__LINE__)) #define nfree(x) (global[1]((x),MODULE_NAME,__FILE__,__LINE__)) -#ifdef DEBUG_CONTEXT -# define Context (global[2](__FILE__, __LINE__, MODULE_NAME)) -#else -# define Context do {} while (0) -#endif +#define Context do {} while (0) /* For backward compatibility only */ #define module_rename ((int (*)(char *, char *))global[3]) /* 4 - 7 */ #define module_register ((int (*)(char *, Function *, int, int))global[4]) @@ -396,11 +392,7 @@ typedef void (*chanout_butfunc)(int, int, const char *, ...) ATTRIBUTE_FORMAT(pr #define nrealloc(x,y) (((void *(*)())global[230])((x),(y),MODULE_NAME,__FILE__,__LINE__)) #define xtra_set ((int(*)(struct userrec *,struct user_entry *, void *))global[231]) /* 232 - 235 */ -#ifdef DEBUG_CONTEXT -# define ContextNote(note) (global[232](__FILE__, __LINE__, MODULE_NAME, note)) -#else -# define ContextNote(note) do {} while (0) -#endif +#define ContextNote(note) do {} while (0) /* For backward compatibility only */ #ifdef DEBUG_ASSERT # define Assert(expr) do { \ if (!(expr)) \ diff --git a/src/modules.c b/src/modules.c index 6c42ff14d..86eb5cae2 100644 --- a/src/modules.c +++ b/src/modules.c @@ -186,11 +186,7 @@ Function global_table[] = { /* 0 - 3 */ (Function) mod_malloc, (Function) mod_free, -#ifdef DEBUG_CONTEXT - (Function) eggContext, -#else - (Function) 0, -#endif + (Function) 0, /* was eggContext() */ (Function) module_rename, /* 4 - 7 */ (Function) module_register, @@ -495,11 +491,7 @@ Function global_table[] = { (Function) mod_realloc, (Function) xtra_set, /* 232 - 235 */ -#ifdef DEBUG_CONTEXT - (Function) eggContextNote, -#else - (Function) 0, -#endif + (Function) 0, /* was eggContextNote() */ #ifdef DEBUG_ASSERT (Function) eggAssert, #else diff --git a/src/net.c b/src/net.c index 7539500fe..3d4c3e838 100644 --- a/src/net.c +++ b/src/net.c @@ -69,6 +69,9 @@ char botuser[USERLEN + 1] = "eggdrop"; /* Username of the user running the bot*/ int dcc_sanitycheck = 0; /* Do some sanity checking on dcc connections. */ sock_list *socklist = NULL; /* Enough to be safe. */ sigjmp_buf alarmret; /* Env buffer for alarm() returns. */ +#ifdef DEBUG_CONTEXT +char last_server_read[512] = ""; +#endif /* Types of proxies */ #define PROXY_SOCKS 1 @@ -995,6 +998,16 @@ int sockread(char *s, int *len, sock_list *slist, int slistmax, int tclonly) } } s[x] = 0; +#ifdef DEBUG_CONTEXT + for (int j = 0; j < dcc_total; j++) { + if (dcc[j].sock == slist[i].sock) { + if (!strcmp(dcc[j].type->name, "SERVER")) { + strlcpy(last_server_read, s, sizeof last_server_read); + } + break; + } + } +#endif *len = x; if (slist[i].flags & SOCK_PROXYWAIT) { debug2("net: socket: %d proxy errno: %d", slist[i].sock, s[1]); @@ -1085,7 +1098,6 @@ int sockread(char *s, int *len, sock_list *slist, int slistmax, int tclonly) * dcc functions. Simply ignore it. * Returns -5 if tcl sockets are busy but not eggdrop sockets. */ - int sockgets(char *s, int *len) { char xx[RECVLINEMAX], *p, *px, *p2; @@ -1270,8 +1282,6 @@ int sockgets(char *s, int *len) } /* Dump something to a socket - * - * NOTE: Do NOT put Contexts in here if you want DEBUG to be meaningful!! */ void tputs(int z, char *s, unsigned int len) { diff --git a/src/proto.h b/src/proto.h index 054fe204d..9591f118f 100644 --- a/src/proto.h +++ b/src/proto.h @@ -187,8 +187,6 @@ int exist_lang_section(char *); /* main.c */ void fatal(const char *, int); int expected_memory(void); -void eggContext(const char *, int, const char *); -void eggContextNote(const char *, int, const char *, const char *); void eggAssert(const char *, int, const char *); void backup_userfile(void); diff --git a/src/tclhash.c b/src/tclhash.c index 71d35f6c2..f1ac23b42 100644 --- a/src/tclhash.c +++ b/src/tclhash.c @@ -57,6 +57,9 @@ static int builtin_chat(); static int builtin_dcc(); static int builtin_log(); +#ifdef DEBUG_CONTEXT +char last_bind_called[512] = ""; +#endif /* Allocate and initialise a chunk of memory. */ @@ -216,7 +219,6 @@ static cd_tcl_cmd cd_cmd_table[] = { void init_bind(void) { bind_table_list = NULL; - Context; add_cd_tcl_cmds(cd_cmd_table); H_unld = add_bind_table("unld", HT_STACKABLE, builtin_char); H_time = add_bind_table("time", HT_STACKABLE, builtin_5int); @@ -244,7 +246,6 @@ void init_bind(void) H_tls = add_bind_table("tls", HT_STACKABLE, builtin_idx); #endif add_builtins(H_dcc, C_dcc); - Context; } void kill_bind(void) @@ -712,22 +713,7 @@ static int trigger_bind(const char *proc, const char *param, char *mask) int x; struct rusage ru1, ru2; int r = 0; -#ifdef DEBUG_CONTEXT - #define FORMAT "Tcl proc: %s, param: %s" - char *buf; - /* We now try to debug the Tcl_VarEval() call below by remembering both - * the called proc name and it's parameters. This should render us a bit - * less helpless when we see context dumps. - */ - Context; - /* reuse x */ - x = snprintf(NULL, 0, FORMAT, proc ? proc : "", param ? param : ""); - buf = nmalloc(x + 1); - sprintf(buf, FORMAT, proc ? proc : "", param ? param : ""); - ContextNote(buf); - nfree(buf); -#endif /* DEBUG_CONTEXT */ /* Set the lastbind variable before evaluating the proc so that the name * of the command that triggered the bind will be available to the proc. @@ -736,11 +722,13 @@ static int trigger_bind(const char *proc, const char *param, char *mask) Tcl_SetVar(interp, "lastbind", (char *) mask, TCL_GLOBAL_ONLY); if(proc && proc[0] != '*') { /* proc[0] != '*' excludes internal binds */ +#ifdef DEBUG_CONTEXT + snprintf(last_bind_called, sizeof last_bind_called, proc); +#endif debug1("triggering bind %s", proc); r = getrusage(RUSAGE_SELF, &ru1); } x = Tcl_VarEval(interp, proc, param, NULL); - Context; if (proc && proc[0] != '*' && !r) { if (!getrusage(RUSAGE_SELF, &ru2)) { debug3("triggered bind %s, user %.3fms sys %.3fms", proc, From 4fddc21ef74022f3d95bf78a6b35996705fdf24a Mon Sep 17 00:00:00 2001 From: Michael Ortmann <41313082+michaelortmann@users.noreply.github.com> Date: Sat, 21 Jan 2023 19:03:57 +0100 Subject: [PATCH 2/9] Better safe than sorry --- src/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net.c b/src/net.c index 3d4c3e838..b7125c7a8 100644 --- a/src/net.c +++ b/src/net.c @@ -1001,7 +1001,7 @@ int sockread(char *s, int *len, sock_list *slist, int slistmax, int tclonly) #ifdef DEBUG_CONTEXT for (int j = 0; j < dcc_total; j++) { if (dcc[j].sock == slist[i].sock) { - if (!strcmp(dcc[j].type->name, "SERVER")) { + if (dcc[j].type && dcc[j].type->name && !strcmp(dcc[j].type->name, "SERVER")) { strlcpy(last_server_read, s, sizeof last_server_read); } break; From 90ed03cf356d04c7eea4f13d1fa679b41fd76ccf Mon Sep 17 00:00:00 2001 From: Michael Ortmann <41313082+michaelortmann@users.noreply.github.com> Date: Sat, 21 Jan 2023 19:10:26 +0100 Subject: [PATCH 3/9] New line --- src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 0851cd358..e88acc7fa 100644 --- a/src/main.c +++ b/src/main.c @@ -276,7 +276,7 @@ static void write_debug() dprintf(-x, "Patch level: %s\n", "stable"); #endif dprintf(-x, "* last server read: %s\n" - "* last bind called: %s", last_server_read, last_bind_called); + "* last bind called: %s\n", last_server_read, last_bind_called); killsock(x); close(x); } @@ -348,7 +348,7 @@ static void write_debug() dprintf(-x, "* Please REPORT this BUG!\n" "* Check doc/BUG-REPORT on how to do so.\n" "* last server read: %s\n" - "* last bind called: %s", last_server_read, last_bind_called); + "* last bind called: %s\n", last_server_read, last_bind_called); tell_dcc(-x); dprintf(-x, "\n"); debug_mem_to_dcc(-x); From cb7136889b68257c8585ad0f119f2293c64368e4 Mon Sep 17 00:00:00 2001 From: Michael Ortmann <41313082+michaelortmann@users.noreply.github.com> Date: Sat, 21 Jan 2023 19:22:45 +0100 Subject: [PATCH 4/9] Fix formatting --- src/main.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/main.c b/src/main.c index e88acc7fa..cab1f6e50 100644 --- a/src/main.c +++ b/src/main.c @@ -285,11 +285,10 @@ static void write_debug() * have caused the fault last time. */ } else nested_debug = 1; - putlog(LOG_MISC, "*", "* Please REPORT this BUG!\n" - "* Check doc/BUG-REPORT on how to do so.\n" - "* last server read: %s\n" - "* last bind called: %s", last_server_read, - last_bind_called); + putlog(LOG_MISC, "*", "* Please REPORT this BUG!"); + putlog(LOG_MISC, "*", "* Check doc/BUG-REPORT on how to do so."); + putlog(LOG_MISC, "*", "* last server read: %s", last_server_read); + putlog(LOG_MISC, "*", "* last bind called: %s", last_bind_called); x = creat("DEBUG", 0644); setsock(x, SOCK_NONSOCK); if (x < 0) { @@ -433,11 +432,10 @@ static void got_ill(int z) { check_tcl_signal("sigill"); #ifdef DEBUG_CONTEXT - putlog(LOG_MISC, "*", "* Please REPORT this BUG!\n" - "* Check doc/BUG-REPORT on how to do so.\n" - "* last server read: %s\n" - "* last bind called: %s", last_server_read, - last_bind_called); + putlog(LOG_MISC, "*", "* Please REPORT this BUG!"); + putlog(LOG_MISC, "*", "* Check doc/BUG-REPORT on how to do so."); + putlog(LOG_MISC, "*", "* last server read: %s", last_server_read); + putlog(LOG_MISC, "*", "* last bind called: %s", last_bind_called); #endif } From eeacfb537e6c90127c8a73224ff0e4efc31204d3 Mon Sep 17 00:00:00 2001 From: Michael Ortmann <41313082+michaelortmann@users.noreply.github.com> Date: Sat, 21 Jan 2023 19:26:18 +0100 Subject: [PATCH 5/9] Fix formatting --- src/main.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/main.c b/src/main.c index cab1f6e50..03ed6b620 100644 --- a/src/main.c +++ b/src/main.c @@ -275,8 +275,8 @@ static void write_debug() #else dprintf(-x, "Patch level: %s\n", "stable"); #endif - dprintf(-x, "* last server read: %s\n" - "* last bind called: %s\n", last_server_read, last_bind_called); + dprintf(-x, "Last server read: %s\n" + "Last bind called: %s\n", last_server_read, last_bind_called); killsock(x); close(x); } @@ -287,8 +287,8 @@ static void write_debug() nested_debug = 1; putlog(LOG_MISC, "*", "* Please REPORT this BUG!"); putlog(LOG_MISC, "*", "* Check doc/BUG-REPORT on how to do so."); - putlog(LOG_MISC, "*", "* last server read: %s", last_server_read); - putlog(LOG_MISC, "*", "* last bind called: %s", last_bind_called); + putlog(LOG_MISC, "*", "* Last server read: %s", last_server_read); + putlog(LOG_MISC, "*", "* Last bind called: %s", last_bind_called); x = creat("DEBUG", 0644); setsock(x, SOCK_NONSOCK); if (x < 0) { @@ -344,10 +344,8 @@ static void write_debug() #ifdef STRIPFLAGS dprintf(-x, "Strip flags: %s\n", STRIPFLAGS); #endif - dprintf(-x, "* Please REPORT this BUG!\n" - "* Check doc/BUG-REPORT on how to do so.\n" - "* last server read: %s\n" - "* last bind called: %s\n", last_server_read, last_bind_called); + dprintf(-x, "Last server read: %s\n" + "Last bind called: %s\n", last_server_read, last_bind_called); tell_dcc(-x); dprintf(-x, "\n"); debug_mem_to_dcc(-x); @@ -434,8 +432,8 @@ static void got_ill(int z) #ifdef DEBUG_CONTEXT putlog(LOG_MISC, "*", "* Please REPORT this BUG!"); putlog(LOG_MISC, "*", "* Check doc/BUG-REPORT on how to do so."); - putlog(LOG_MISC, "*", "* last server read: %s", last_server_read); - putlog(LOG_MISC, "*", "* last bind called: %s", last_bind_called); + putlog(LOG_MISC, "*", "* Last server read: %s", last_server_read); + putlog(LOG_MISC, "*", "* Last bind called: %s", last_bind_called); #endif } From d8843b4f77b11ca2bcde3c124d6aaf29a497e47a Mon Sep 17 00:00:00 2001 From: Michael Ortmann <41313082+michaelortmann@users.noreply.github.com> Date: Sun, 22 Jan 2023 05:57:24 +0100 Subject: [PATCH 6/9] Cleanup --- src/tclhash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tclhash.c b/src/tclhash.c index f1ac23b42..3d4c783e0 100644 --- a/src/tclhash.c +++ b/src/tclhash.c @@ -719,7 +719,7 @@ static int trigger_bind(const char *proc, const char *param, char *mask) * of the command that triggered the bind will be available to the proc. * This feature is used by scripts such as userinfo.tcl */ - Tcl_SetVar(interp, "lastbind", (char *) mask, TCL_GLOBAL_ONLY); + Tcl_SetVar(interp, "lastbind", mask, TCL_GLOBAL_ONLY); if(proc && proc[0] != '*') { /* proc[0] != '*' excludes internal binds */ #ifdef DEBUG_CONTEXT From 3e896870ad6e32b0aa9ec3f99487bdf5d10244e8 Mon Sep 17 00:00:00 2001 From: Michael Ortmann <41313082+michaelortmann@users.noreply.github.com> Date: Sun, 22 Jan 2023 06:02:51 +0100 Subject: [PATCH 7/9] Cleanup --- src/net.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/net.c b/src/net.c index b7125c7a8..2f6c4c695 100644 --- a/src/net.c +++ b/src/net.c @@ -1001,9 +1001,8 @@ int sockread(char *s, int *len, sock_list *slist, int slistmax, int tclonly) #ifdef DEBUG_CONTEXT for (int j = 0; j < dcc_total; j++) { if (dcc[j].sock == slist[i].sock) { - if (dcc[j].type && dcc[j].type->name && !strcmp(dcc[j].type->name, "SERVER")) { + if (dcc[j].type && dcc[j].type->name && !strcmp(dcc[j].type->name, "SERVER")) strlcpy(last_server_read, s, sizeof last_server_read); - } break; } } From 8f7fbd8f064081a3eca84e03d2157c4cc22c5e95 Mon Sep 17 00:00:00 2001 From: Michael Ortmann Date: Thu, 4 Jan 2024 00:41:49 +0100 Subject: [PATCH 8/9] Remove last-server-read info --- src/main.c | 9 +-------- src/net.c | 12 ------------ 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/src/main.c b/src/main.c index 16ec3d51a..2bdb375c2 100644 --- a/src/main.c +++ b/src/main.c @@ -171,7 +171,6 @@ unsigned long itraffic_unknown = 0; unsigned long itraffic_unknown_today = 0; #ifdef DEBUG_CONTEXT -extern char last_server_read[]; extern char last_bind_called[]; #endif @@ -275,8 +274,6 @@ static void write_debug() #else dprintf(-x, "Patch level: %s\n", "stable"); #endif - if (*last_server_read) - dprintf(-x, "Last server read: %s\n", last_server_read); if (*last_bind_called) dprintf(-x, "Last bind called: %s\n", last_bind_called); killsock(x); @@ -289,8 +286,6 @@ static void write_debug() nested_debug = 1; putlog(LOG_MISC, "*", "* Please report problem to https://github.com/eggheads/eggdrop/issues"); putlog(LOG_MISC, "*", "* Check doc/BUG-REPORT on how to do so."); - if (*last_server_read) - putlog(LOG_MISC, "*", "* Last server read: %s", last_server_read); if (*last_bind_called) putlog(LOG_MISC, "*", "* Last bind called: %s", last_bind_called); x = creat("DEBUG", 0644); @@ -348,8 +343,7 @@ static void write_debug() #ifdef STRIPFLAGS dprintf(-x, "Strip flags: %s\n", STRIPFLAGS); #endif - dprintf(-x, "Last server read: %s\n" - "Last bind called: %s\n", last_server_read, last_bind_called); + dprintf(-x, "Last bind called: %s\n", last_bind_called); tell_dcc(-x); dprintf(-x, "\n"); debug_mem_to_dcc(-x); @@ -436,7 +430,6 @@ static void got_ill(int z) #ifdef DEBUG_CONTEXT putlog(LOG_MISC, "*", "* Please REPORT this BUG!"); putlog(LOG_MISC, "*", "* Check doc/BUG-REPORT on how to do so."); - putlog(LOG_MISC, "*", "* Last server read: %s", last_server_read); putlog(LOG_MISC, "*", "* Last bind called: %s", last_bind_called); #endif } diff --git a/src/net.c b/src/net.c index f6c3ae770..20efb0afc 100644 --- a/src/net.c +++ b/src/net.c @@ -69,9 +69,6 @@ char botuser[USERLEN + 1] = "eggdrop"; /* Username of the user running the bot*/ int dcc_sanitycheck = 0; /* Do some sanity checking on dcc connections. */ sock_list *socklist = NULL; /* Enough to be safe. */ sigjmp_buf alarmret; /* Env buffer for alarm() returns. */ -#ifdef DEBUG_CONTEXT -char last_server_read[512] = ""; -#endif /* Types of proxies */ #define PROXY_SOCKS 1 @@ -1010,15 +1007,6 @@ int sockread(char *s, int *len, sock_list *slist, int slistmax, int tclonly) } } s[x] = 0; -#ifdef DEBUG_CONTEXT - for (int j = 0; j < dcc_total; j++) { - if (dcc[j].sock == slist[i].sock) { - if (dcc[j].type && dcc[j].type->name && !strcmp(dcc[j].type->name, "SERVER")) - strlcpy(last_server_read, s, sizeof last_server_read); - break; - } - } -#endif *len = x; if (slist[i].flags & SOCK_PROXYWAIT) { debug2("net: socket: %d proxy errno: %d", slist[i].sock, s[1]); From 7ae2cca90126071b8c07442dbca88a2d1c463e90 Mon Sep 17 00:00:00 2001 From: Geo Date: Sun, 7 Jan 2024 15:08:22 -0500 Subject: [PATCH 9/9] Update words --- src/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.c b/src/main.c index 2bdb375c2..e860323d2 100644 --- a/src/main.c +++ b/src/main.c @@ -275,7 +275,7 @@ static void write_debug() dprintf(-x, "Patch level: %s\n", "stable"); #endif if (*last_bind_called) - dprintf(-x, "Last bind called: %s\n", last_bind_called); + dprintf(-x, "Last bind (may not be related): %s\n", last_bind_called); killsock(x); close(x); } @@ -287,7 +287,7 @@ static void write_debug() putlog(LOG_MISC, "*", "* Please report problem to https://github.com/eggheads/eggdrop/issues"); putlog(LOG_MISC, "*", "* Check doc/BUG-REPORT on how to do so."); if (*last_bind_called) - putlog(LOG_MISC, "*", "* Last bind called: %s", last_bind_called); + putlog(LOG_MISC, "*", "* Last bind (may not be related): %s", last_bind_called); x = creat("DEBUG", 0644); setsock(x, SOCK_NONSOCK); if (x < 0) { @@ -343,7 +343,7 @@ static void write_debug() #ifdef STRIPFLAGS dprintf(-x, "Strip flags: %s\n", STRIPFLAGS); #endif - dprintf(-x, "Last bind called: %s\n", last_bind_called); + dprintf(-x, "Last bind (may not be related): %s\n", last_bind_called); tell_dcc(-x); dprintf(-x, "\n"); debug_mem_to_dcc(-x); @@ -430,7 +430,7 @@ static void got_ill(int z) #ifdef DEBUG_CONTEXT putlog(LOG_MISC, "*", "* Please REPORT this BUG!"); putlog(LOG_MISC, "*", "* Check doc/BUG-REPORT on how to do so."); - putlog(LOG_MISC, "*", "* Last bind called: %s", last_bind_called); + putlog(LOG_MISC, "*", "* Last bind (may not be related): %s", last_bind_called); #endif }