Преглед изворни кода

* Restart() now uses -B to only restart the currently running bot

svn: 1343
Bryan Drewery пре 21 година
родитељ
комит
a02ddc0b1c
1 измењених фајлова са 5 додато и 2 уклоњено
  1. 5 2
      src/misc.c

+ 5 - 2
src/misc.c

@@ -647,6 +647,8 @@ void kill_bot(char *s1, char *s2)
 void 
 void 
 restart(int idx)
 restart(int idx)
 {
 {
+  char buf[1024] = "";
+
 #ifdef HUB
 #ifdef HUB
   write_userfile(idx);
   write_userfile(idx);
 #endif /* HUB */
 #endif /* HUB */
@@ -657,10 +659,11 @@ restart(int idx)
     botnet_send_chat(-1, conf.bot->nick, "Updating...");
     botnet_send_chat(-1, conf.bot->nick, "Updating...");
     botnet_send_bye();
     botnet_send_bye();
   }
   }
-  fatal(idx <= 0x7FF0 ? "Updating..." : NULL, 1);
+  fatal(idx <= 0x7FF0 && idx != -1 ? "Updating..." : NULL, 1);
   usleep(2000 * 500);
   usleep(2000 * 500);
   unlink(conf.bot->pid_file); /* if this fails it is ok, cron will restart the bot, *hopefully* */
   unlink(conf.bot->pid_file); /* if this fails it is ok, cron will restart the bot, *hopefully* */
-  system(binname); /* start new bot. */
+  sprintf(buf, "%s -B %s\n", binname, conf.bot->nick);
+  system(buf); /* start new bot. */
   exit(0);
   exit(0);
 }
 }