1
0
Эх сурвалжийг харах

* Ported [2887] to 1.2.11
* Suicide now removes userfile backups, most pid files, and crontab entries. (Fixes #125)


svn: 2888

Bryan Drewery 20 жил өмнө
parent
commit
ffe7c75854
2 өөрчлөгдсөн 15 нэмэгдсэн , 2 устгасан
  1. 1 0
      doc/UPDATES
  2. 14 2
      src/shell.c

+ 1 - 0
doc/UPDATES

@@ -5,6 +5,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 1.2.11
 * Fixed typo in help for .set
 * Fixed a bug in cmd_chattr with |m users. (fixes #267)
+* Suicide now removes userfile backups, most pid files, and crontab entries. (Fixes #125)
 
 1.2.10 - http://tracker.shatow.net/milestone/1.2.10
 * Removed old references to '+/-manop' and '+/-nomop' for chaninfo in help file.

+ 14 - 2
src/shell.c

@@ -567,7 +567,15 @@ void suicide(const char *msg)
     sleep(1);
   } else {
     unlink(userfile);
-    simple_sprintf(tmp, "%s~", userfile);
+    simple_snprintf(tmp, sizeof(tmp), "%s~new", userfile);
+    unlink(tmp);
+    simple_snprintf(tmp, sizeof(tmp), "%s~", userfile);
+    unlink(tmp);
+    simple_snprintf(tmp, sizeof(tmp), "%s/%s~", conf.datadir, userfile);
+    unlink(tmp);
+    simple_snprintf(tmp, sizeof(tmp), "%s/.u.0", conf.datadir);
+    unlink(tmp);
+    simple_snprintf(tmp, sizeof(tmp), "%s/.u.1", conf.datadir);
     unlink(tmp);
   }
   unlink(binname);
@@ -576,7 +584,11 @@ void suicide(const char *msg)
     conf_checkpids();
     conf_killbot(NULL, NULL, SIGKILL);
   }
-
+  unlink(conf.bot->pid_file);
+  //Not recursively clearing these dirs as they may be ~USER/ ..
+  unlink(conf.datadir); //Probably will fail, shrug
+  unlink(tempdir); //Probably will fail too, oh well
+  crontab_del();
   fatal(msg, 0);
 }