Bläddra i källkod

* Small fixes

svn: 1055
Bryan Drewery 22 år sedan
förälder
incheckning
587bcb0ed1
3 ändrade filer med 21 tillägg och 8 borttagningar
  1. 10 3
      src/debug.c
  2. 7 0
      src/main.c
  3. 4 5
      src/mod/update.mod/update.c

+ 10 - 3
src/debug.c

@@ -112,7 +112,6 @@ void write_debug()
   int y;
 
   if (nested_debug) {
-    signal(SIGSEGV, SIG_DFL);
     /* Yoicks, if we have this there's serious trouble!
      * All of these are pretty reliable, so we'll try these.
      *
@@ -259,9 +258,16 @@ stackdump(int idx)
 {
   __asm__("movl %EBP, %EAX");
   __asm__("movl %EAX, sf");
-  dprintf(idx, "STACK DUMP (%%ebp)\n");
+  if (idx == -1)
+    putlog(LOG_MISC, "*", "STACK DUMP (%%ebp)");
+  else
+    dprintf(idx, "STACK DUMP (%%ebp)\n");
+
   while (canaccess(sf) && stackdepth < 20) {
-    dprintf(idx, " %02d: 0x%08lx/0x%08lx\n", stackdepth, (unsigned long) sf->ebp, sf->addr);
+    if (idx == -1)
+      putlog(LOG_MISC, "*", " %02d: 0x%08lx/0x%08lx", stackdepth, (unsigned long) sf->ebp, sf->addr);
+    else
+      dprintf(idx, " %02d: 0x%08lx/0x%08lx\n", stackdepth, (unsigned long) sf->ebp, sf->addr);
     sf = sf->ebp;
     stackdepth++;
   }
@@ -271,6 +277,7 @@ stackdump(int idx)
 
 static void got_segv(int z)
 {
+  signal(SIGSEGV, SIG_DFL);
   stackdump(-1);
 #ifdef DEBUG_CONTEXT
   write_debug();

+ 7 - 0
src/main.c

@@ -667,6 +667,11 @@ void compress_init();
 void share_init();
 void transfer_init();
 
+void _start();
+int tracecheck_breakpoint() {
+  unsigned char * u = (unsigned char *) _start;
+  return (*u == 0xCC);
+}
 
 int main(int argc, char **argv)
 {
@@ -895,6 +900,8 @@ int main(int argc, char **argv)
   debug0("main: entering loop");
 
   while (1) {
+//if (tracecheck_breakpoint())
+//exit(0);
     int socket_cleanup = 0, i, xx;
     char buf[SGRAB + 10] = "";
 

+ 4 - 5
src/mod/update.mod/update.c

@@ -166,10 +166,8 @@ static void got_nu(char *botnick, char *code, char *par)
 /* needupdate? curver */
   time_t newts;
 #ifdef LEAF
-  tand_t *bot = NULL;
 
-  bot = tandbot;
-  if (bot->bot && !strcmp(bot->bot, botnick)) /* dont listen to our uplink.. use normal upate system.. */
+  if (tandbot && tandbot->bot && !strcmp(tandbot->bot, botnick)) /* dont listen to our uplink.. use normal upate system.. */
     return;
 
   if (!localhub)
@@ -178,7 +176,8 @@ static void got_nu(char *botnick, char *code, char *par)
   if (localhub && updated)
     return;
 #endif /* LEAF */
-   if (!par || (par && !par[0])) return;
+   if (!par || !*par) 
+     return;
    newts = atol(newsplit(&par));
    if (newts > buildts) {
 #ifdef LEAF
@@ -197,7 +196,7 @@ static void got_nu(char *botnick, char *code, char *par)
    /* Change our uplink to them */
    /* let cont_link restructure us.. */
      putlog(LOG_MISC, "*", "Changed uplink to %s for update.", botnick);
-     botunlink(-2, bot->bot, "Restructure for update.");
+     botunlink(-2, tandbot->bot, "Restructure for update.");
      usleep(1000 * 500);
      botlink("", -3, botnick);
 #else