فهرست منبع

* Port [3986] to 1.2.16 from trunk
* Fixed bot dying off when it can't create a temporary file. (fixes #412)



svn: 3987

Bryan Drewery 17 سال پیش
والد
کامیت
fbb84ada4c
4فایلهای تغییر یافته به همراه11 افزوده شده و 5 حذف شده
  1. 1 0
      doc/UPDATES
  2. 2 1
      src/conf.c
  3. 2 1
      src/main.c
  4. 6 3
      src/misc_file.c

+ 1 - 0
doc/UPDATES

@@ -23,6 +23,7 @@
 * Fix /ctcp FINGER leaking shell username when using oidentd
 * Fix ISON not working on some ircds.
 * Fix a socket leak from timed out userfile transfers.
+* Fixed bot dying off when it can't create a temporary file. (fixes #412)
 
 1.2.15 - http://wraith.botpack.net/milestone/1.2.15
 * Fix a possible segfault when binaries compiled wrong

+ 2 - 1
src/conf.c

@@ -1150,7 +1150,8 @@ bin_to_conf(bool error)
 
   str_redup(&conf.datadir, replace(datadir, conf.binpath, "."));
 
-  Tempfile::FindDir();
+  if (Tempfile::FindDir() == ERROR)
+    werr(ERR_TMPSTAT);
 
   if (clear_tmpdir)
     clear_tmp();	/* clear out the tmp dir, no matter if we are localhub or not */

+ 2 - 1
src/main.c

@@ -757,7 +757,8 @@ printf("out: %s\n", out);
 
   /* Find a temporary tempdir until we load binary data */
   /* setup initial tempdir as /tmp until we read in tmpdir from conf */
-  Tempfile::FindDir();
+  if (Tempfile::FindDir() == ERROR)
+    werr(ERR_TMPSTAT);
 
   /* This allows -2/-0 to be used without an initialized binary */
 //  if (!(argc == 2 && (!strcmp(argv[1], "-2") || !strcmp(argv[1], "0")))) {

+ 6 - 3
src/misc_file.c

@@ -227,8 +227,11 @@ error:
   /* Since we failed to create a file in the given tempdir, let's try finding a new one */
   if (!looking) {
     /* ... Not finding a new tempdir is fatal. */
-    if (FindDir() == ERROR)
-      werr(ERR_TMPSTAT);		/* FIXME: Perhaps this should be an exception? */
+    if (FindDir() == ERROR) {
+      delete[] file;
+      file = NULL;
+      return;
+    }
     /* ... If we found one, let's try all over! */
     else {
       error = 0;
@@ -329,6 +332,6 @@ bool Tempfile::FindDir()
     }
   }
 
-  werr(ERR_TMPSTAT);
+  return ERROR;
 #endif /* CYGWIN_HACKS */
 }