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

* Added int to write_settings() to specify whether to write conf or not

svn: 1852
Bryan Drewery пре 21 година
родитељ
комит
a681922a71
4 измењених фајлова са 8 додато и 7 уклоњено
  1. 4 4
      src/binary.c
  2. 1 1
      src/binary.h
  3. 1 1
      src/cmds.c
  4. 2 1
      src/misc.c

+ 4 - 4
src/binary.c

@@ -396,7 +396,7 @@ static bool check_bin_initialized(const char *fname)
   return 0;
 }
 
-void write_settings(const char *fname, int die)
+void write_settings(const char *fname, int die, int conf)
 {
   MD5_CTX ctx;
   char *hash = NULL;
@@ -411,8 +411,8 @@ void write_settings(const char *fname, int die)
    */
   if (!initialized)
     bits |= WRITE_PACK;
-
-  bits |= WRITE_CONF;		/* always for now */
+  if (conf)
+    bits |= WRITE_CONF;
 
   if ((hash = bin_checksum(fname, bits, &ctx))) {
     printf("* Wrote settings to: %s.\n", fname);
@@ -465,5 +465,5 @@ void conf_to_bin(conf_t *in, bool move)
   else
     newbin = binname;
   /* tellconfig(&settings); */
-  write_settings(newbin, 1);
+  write_settings(newbin, 1, 1);
 }

+ 1 - 1
src/binary.h

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

+ 1 - 1
src/cmds.c

@@ -1841,7 +1841,7 @@ static void cmd_conf(int idx, char *par)
     free(listbot);
 
   if (save) {
-    write_settings(binname, -1);
+    write_settings(binname, -1, 1);
     if (!conf.bot->hub)
       spawnbots();			/* parse conf struct and spawn/kill as needed */
   }

+ 2 - 1
src/misc.c

@@ -683,7 +683,8 @@ int updatebin(int idx, char *par, int secs)
   egg_snprintf(old, sizeof old, "%s.bin.old", tempdir);
   copyfile(binname, old);
 
-  write_settings(path, -1);	/* re-write the binary with our data */
+  write_settings(path, -1, 1);	/* re-write the binary with our data */
+  
 
   /* The binary should return '2' when ran with -2, if not it's probably corrupt. */
   egg_snprintf(testbuf, sizeof testbuf, "%s -2", path);