Sfoglia il codice sorgente

* When udpating, send all logging to idx -1

Bryan Drewery 16 anni fa
parent
commit
ee88d2b15e
3 ha cambiato i file con 5 aggiunte e 7 eliminazioni
  1. 1 1
      src/log.c
  2. 3 5
      src/misc.c
  3. 1 1
      src/mod/update.mod/update.c

+ 1 - 1
src/log.c

@@ -151,7 +151,7 @@ void logidx(int idx, const char *format, ...)
   va_end(va);
 
   if (idx < 0)
-    putlog(LOG_DEBUG, "*", "%s", va_out);
+    putlog(LOG_MISC, "*", "%s", va_out);
   else
     dprintf(idx, "%s\n", va_out);
 }

+ 3 - 5
src/misc.c

@@ -948,7 +948,7 @@ int updatebin(int idx, char *par, int secs)
   Tempfile *conffile = new Tempfile("conf");
 
   if (writeconf(NULL, conffile->fd, CONF_ENC)) {
-    putlog(LOG_MISC, "*", STR("Failed to write temporary config file for update."));
+    logidx(idx, STR("Failed to write temporary config file for update."));
     delete conffile;
     return 1;
   }
@@ -961,8 +961,7 @@ int updatebin(int idx, char *par, int secs)
   argv[2] = 0;
   i = simple_exec(argv);
   if (i == -1 || WEXITSTATUS(i) != 2) {
-    dprintf(idx, STR("Couldn't restart new binary (error %d)\n"), i);
-    putlog(LOG_MISC, "*", STR("Couldn't restart new binary (error %d)"), i);
+    logidx(idx, STR("Couldn't restart new binary (error %d)"), i);
     delete conffile;
     return i;
   }
@@ -978,8 +977,7 @@ int updatebin(int idx, char *par, int secs)
   i = simple_exec(argv);
   delete conffile;
   if (i == -1 || WEXITSTATUS(i) != 6) { /* 6 for successfull config read/write */
-    dprintf(idx, STR("Couldn't pass config to new binary (error %d)\n"), i);
-    putlog(LOG_MISC, "*", STR("Couldn't pass config to new binary (error %d)"), i);
+    logidx(idx, STR("Couldn't pass config to new binary (error %d)"), i);
     return i;
   }
 #endif /* !CYGWIN_HACKS */

+ 1 - 1
src/mod/update.mod/update.c

@@ -253,7 +253,7 @@ void finish_update_stream(int idx, bd::Stream& stream)
   putlog(LOG_DEBUG, "*", "Update binary is %zu bytes.", stream.length());
   putlog(LOG_MISC, "*", "Updating with binary: %s", buf2);
   
-  if (updatebin(0, buf2, 120)) {
+  if (updatebin(-1, buf2, 120)) {
     putlog(LOG_MISC, "*", "Failed to update to new binary..");
     unlink(buf2);
   } else