From 64d58d0c5a01551f8bfc52291986d1b8d681aca5 Mon Sep 17 00:00:00 2001 From: Dave Hibberd Date: Mon, 3 Feb 2025 22:18:58 +0000 Subject: New upstream version 6.0.24.59a+repack --- LinBPQ.c | 58 +++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 15 deletions(-) (limited to 'LinBPQ.c') diff --git a/LinBPQ.c b/LinBPQ.c index bd380e1..295afd8 100644 --- a/LinBPQ.c +++ b/LinBPQ.c @@ -21,7 +21,7 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses #define _CRT_SECURE_NO_DEPRECATE -#include "CHeaders.h" +#include "cheaders.h" #include "bpqmail.h" #ifdef WIN32 #include @@ -45,7 +45,11 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses BOOL APIENTRY Rig_Init(); -void GetSemaphore(struct SEM * Semaphore, int ID); + + +#define GetSemaphore(Semaphore,ID) _GetSemaphore(Semaphore, ID, __FILE__, __LINE__) + +void _GetSemaphore(struct SEM * Semaphore, int ID, char * File, int Line); void FreeSemaphore(struct SEM * Semaphore); VOID CopyConfigFile(char * ConfigName); VOID SendMailForThread(VOID * Param); @@ -75,6 +79,8 @@ int upnpClose(); void SaveAIS(); void initAIS(); void DRATSPoll(); +void RHPPoll(); + VOID GetPGConfig(); void SendBBSDataToPktMap(); @@ -374,24 +380,41 @@ BOOL CtrlHandler(DWORD fdwCtrlType) #include #include - // Linux Signal Handlers - static void segvhandler(int sig) { - void *array[10]; - size_t size; + void *array[10]; + size_t size; + char msg[] = "SIGSEGV Received\n"; + + write(STDERR_FILENO, msg, strlen(msg)); + + // get void*'s for all entries on the stack + size = backtrace(array, 10); + + // print out all the frames to stderr - // get void*'s for all entries on the stack - size = backtrace(array, 10); + backtrace_symbols_fd(array, size, STDERR_FILENO); - // print out all the frames to stderr - fprintf(stderr, "Error: signal %d:\n", sig); - backtrace_symbols_fd(array, size, STDERR_FILENO); exit(1); } +static void abrthandler(int sig) +{ + void *array[10]; + size_t size; + char msg[] = "SIGABRT Received\n"; + + write(STDERR_FILENO, msg, strlen(msg)); + + // get void*'s for all entries on the stack + + size = backtrace(array, 10); + backtrace_symbols_fd(array, size, STDERR_FILENO); + + exit(1); +} static void sigterm_handler(int sig) { @@ -481,9 +504,10 @@ VOID MonitorThread(void * x) { // It is stuck - try to release - Debugprintf ("Semaphore locked - Process ID = %d, Held By %d", - Semaphore.SemProcessID, SemHeldByAPI); - + Debugprintf ("Semaphore locked - Process ID = %d, Held By %d from %s Line %d", + Semaphore.SemProcessID, SemHeldByAPI, Semaphore.File, Semaphore.Line); + + Semaphore.Flag = 0; } @@ -761,6 +785,8 @@ char HelpScreen[] = int Redirected = 0; static void segvhandler(int sig); +static void abrthandler(int sig); + int main(int argc, char * argv[]) { @@ -792,7 +818,8 @@ int main(int argc, char * argv[]) #else -// signal(SIGSEGV, segvhandler); + signal(SIGSEGV, segvhandler); + signal(SIGABRT, abrthandler); setlinebuf(stdout); struct sigaction act; @@ -1560,6 +1587,7 @@ int main(int argc, char * argv[]) Poll_AGW(); DRATSPoll(); + RHPPoll(); HTTPTimer(); -- cgit v1.2.3