Просмотр исходного кода

Make ./wraith -q and -Q clearly exit when already written.

Bryan Drewery 7 лет назад
Родитель
Сommit
c195b88eab
4 измененных файлов с 7 добавлено и 1 удалено
  1. 1 0
      doc/UPDATES.md
  2. 2 0
      src/binary.cc
  3. 2 0
      src/shell.cc
  4. 2 1
      src/shell.h

+ 1 - 0
doc/UPDATES.md

@@ -4,6 +4,7 @@
   * Bots now share channel key to other bots even if not opped.
   * Some small performance improvements.
   * Fix rare issue with writing binary config.
+  * Make ./wraith -q and -Q clearly exit when already written.
 
 # 1.4.9
   * Fix various compile warnings and spam

+ 2 - 0
src/binary.cc

@@ -651,6 +651,8 @@ check_sum(const char *fname, const char *cfgfile, bool read_stdin)
       printf(STR("* Wrote settings to binary.\n")); 
     exit(0);
   } else {
+    if (cfgfile || read_stdin)
+      werr(ERR_ALREADYINIT);
     char *hash = bin_checksum(fname, GET_CHECKSUM);
 
 // tellconfig(&settings); 

+ 2 - 0
src/shell.cc

@@ -740,6 +740,8 @@ const char *werr_tostr(int errnum)
     return STR("Too many bots defined. 5 max. Too many will lead to klines.\nSpread out into multiple accounts/shells/ip ranges.");
   case ERR_LIBS:
     return STR("Failed to load required libraries.\nEnsure that 32bit glibc, OpenSSL and libgcc are installed.\nhttps://github.com/wraith/wraith/wiki/Binary-Compatibiliy");
+  case ERR_ALREADYINIT:
+    return STR("Binary settings already written.");
   default:
     return STR("Unforseen error");
   }

+ 2 - 1
src/shell.h

@@ -24,7 +24,8 @@
 #define ERR_NOTINIT	22
 #define ERR_TOOMANYBOTS 23
 #define ERR_LIBS	24
-#define ERR_MAX         25
+#define ERR_ALREADYINIT 25
+#define ERR_MAX         26
 
 #define DETECT_LOGIN 	1
 #define DETECT_TRACE 	2