ソースを参照

* Fixed localhub attempting to spawn itself during binary rehash and cmd_conf

svn: 2260
Bryan Drewery 21 年 前
コミット
e2ed1f0606
5 ファイル変更6 行追加5 行削除
  1. 1 0
      doc/UPDATES
  2. 1 1
      src/binary.c
  3. 1 1
      src/cmds.c
  4. 2 2
      src/conf.c
  5. 1 1
      src/conf.h

+ 1 - 0
doc/UPDATES

@@ -22,6 +22,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Fixed delay of requesting op spamming logs with delay msgs.
 * Added a 5 second delay on requesting/checking ops when no bots are available to ask.
 * Fixed 16 bytes after packdata being cleared in memory, causing random memory corruption.
+* Fixed localhub attempting to spawn itself during binary rehash and cmd_conf
 
 1.2.4
 * Fixed cmd_botset not displaying botnick.

+ 1 - 1
src/binary.c

@@ -536,7 +536,7 @@ void reload_bin_data() {
       /* add any bots not in userfile */
       conf_add_userlist_bots();
       /* start/disable new bots as necesary */
-      spawnbots();
+      spawnbots(1);		//1 signifies to not start me!
     } else
       free_conf_bots(conf.bots);
 

+ 1 - 1
src/cmds.c

@@ -1730,7 +1730,7 @@ static void cmd_conf(int idx, char *par)
 
     kill_removed_bots(oldlist, conf.bots);
     conf_add_userlist_bots();
-    spawnbots();
+    spawnbots(1);
   }
 
   free_conf_bots(oldlist);

+ 2 - 2
src/conf.c

@@ -98,7 +98,7 @@ void spawnbot(const char *nick)
  * bots prefixxed with '/' will be killed auto if running.
  * if (updating) then we were called with -U or -u */
 void
-spawnbots()
+spawnbots(bool rehashed)
 {
   conf_bot *bot = NULL;
 
@@ -115,7 +115,7 @@ spawnbots()
       -if updating and we find our nick, skip
       -if pid exists and not updating, bot is running and we have nothing more to do, skip.
      */
-    } else if ((!strcmp(bot->nick, conf.bot->nick) && updating == UPDATE_AUTO) || (bot->pid && !updating)) {
+    } else if ((!strcmp(bot->nick, conf.bot->nick) && (updating == UPDATE_AUTO || rehashed)) || (bot->pid && !updating)) {
       sdprintf(" ... skipping. Updating: %d, pid: %d", updating, bot->pid);
       continue;
     } else {

+ 1 - 1
src/conf.h

@@ -55,7 +55,7 @@ enum {
 
 
 void spawnbot(const char *);
-void spawnbots();
+void spawnbots(bool rehashed = 0);
 int conf_killbot(const char *, conf_bot *, int);
 void confedit() __attribute__((noreturn));
 void conf_addbot(char *, char *, char *, char *);