Răsfoiți Sursa

* Fixed SIGUSR1 signal after -C not working

svn: 1951
Bryan Drewery 21 ani în urmă
părinte
comite
82c8acfaf5
4 a modificat fișierele cu 12 adăugiri și 10 ștergeri
  1. 1 5
      src/binary.c
  2. 1 1
      src/binary.h
  3. 9 3
      src/conf.c
  4. 1 1
      src/main.c

+ 1 - 5
src/binary.c

@@ -460,7 +460,7 @@ clear_settings(void)
   memset(&settings.bots, 0, sizeof(settings_t) - 3467);
 }
 
-void conf_to_bin(conf_t *in, bool move, int die, bool refresh)
+void conf_to_bin(conf_t *in, bool move, int die)
 {
   conf_bot *bot = NULL;
   char *newbin = NULL;
@@ -497,10 +497,6 @@ void conf_to_bin(conf_t *in, bool move, int die, bool refresh)
   /* tellconfig(&settings); */
   write_settings(newbin, -1, 1);
 
-  /* alert the localhub of changes */
-  if (refresh && conf.bots && conf.bots->pid)
-    kill(conf.bots->pid, SIGUSR1);
-
   if (die >= 0)
     exit(die);
 }

+ 1 - 1
src/binary.h

@@ -13,6 +13,6 @@ extern int checked_bin_buf;
 
 void check_sum(const char *, const char *);
 void write_settings(const char *, int, bool);
-void conf_to_bin(conf_t *, bool, int, bool);
+void conf_to_bin(conf_t *, bool, int);
 void reload_bin_data();
 #endif /* !_BINARY_H */

+ 9 - 3
src/conf.c

@@ -163,7 +163,7 @@ confedit()
   char *editor = NULL;
   mode_t um;
   int waiter;
-  pid_t pid, xpid;
+  pid_t pid, xpid, localhub_pid = 0;
 
 
   um = umask(077);
@@ -255,11 +255,17 @@ confedit()
 
   if (!can_stat(tmpconf.file))
     fatal("Error reading new config file", 0);
+
+  if (conf.bots && conf.bots->pid)
+    localhub_pid = conf.bots->pid;
+
   readconf((const char *) tmpconf.file, 0);               /* read cleartext conf tmp into &settings */
   fix_tilde(&conf.binpath);
   unlink(tmpconf.file);
-  conf_to_bin(&conf, 0, 1, 1);	/* will exit */
-  exit(0);                      /* never reached */
+  conf_to_bin(&conf, 0, -1);
+  if (localhub_pid)
+    kill(localhub_pid, SIGUSR1);
+  exit(0);
 
 fatal:
   unlink(tmpconf.file);

+ 1 - 1
src/main.c

@@ -296,7 +296,7 @@ static void dtx_arg(int argc, char *argv[])
         readconf(optarg, CONF_ENC);
         fix_tilde(&conf.binpath);
         parseconf(0);
-        conf_to_bin(&conf, 0, 6, 0);		/* this will exit() in write_settings() */
+        conf_to_bin(&conf, 0, 6);		/* this will exit() in write_settings() */
       case 'B':
         localhub = 0;
         used_B = 1;