Explorar o código

* Forget tempdir, we are doing it during compile now anyway

svn: 889
Bryan Drewery %!s(int64=22) %!d(string=hai) anos
pai
achega
de0673bcd4
Modificáronse 2 ficheiros con 12 adicións e 13 borrados
  1. 2 2
      src/binary.c
  2. 10 11
      src/main.c

+ 2 - 2
src/binary.c

@@ -67,13 +67,13 @@ bin_md5(const char *fname, int todo)
     size = ftell(f);
     fseek(f, 0, SEEK_SET);
 
-    egg_snprintf(s, sizeof s, "%s.bin-XXXXXX", tempdir);
+    egg_snprintf(s, sizeof s, ".bin-XXXXXX");
     if ((fd = mkstemp(s)) == -1 || (fn = fdopen(fd, "wb")) == NULL) {
       if (fd != -1) {
         unlink(s);
         close(fd);
       }
-      fatal("Can't write to tempdir!", 0);
+      fatal("Can't create temporary file!", 0);
     }
 
     while ((len = fread(buf, 1, sizeof buf - 1, f))) {

+ 10 - 11
src/main.c

@@ -697,17 +697,6 @@ int main(int argc, char **argv)
   srandom(now % (getpid() + getppid()));
   myuid = geteuid();
 
-#ifdef HUB
-  egg_snprintf(tempdir, sizeof tempdir, "%s/tmp/", confdir());
-#endif /* HUB */
-#ifdef LEAF 
-  egg_snprintf(tempdir, sizeof tempdir, "%s/.../", confdir());
-#endif /* LEAF */
-#ifdef CYGWIN_HACKS
-  egg_snprintf(tempdir, sizeof tempdir, "%s/tmp/", confdir());
-#endif /* CYGWIN_HACKS */
-  clear_tmp();		/* clear out the tmp dir, no matter if we are localhub or not */
-
   binname = getfullbinname(argv[0]);
 
 #ifndef CYGWIN_HACKS
@@ -732,6 +721,16 @@ int main(int argc, char **argv)
   egg_snprintf(userfile, 121, "%s/.u", confdir());
 #endif /* HUB */
 
+#ifdef HUB
+  egg_snprintf(tempdir, sizeof tempdir, "%s/tmp/", confdir());
+#endif /* HUB */
+#ifdef LEAF 
+  egg_snprintf(tempdir, sizeof tempdir, "%s/.../", confdir());
+#endif /* LEAF */
+#ifdef CYGWIN_HACKS
+  egg_snprintf(tempdir, sizeof tempdir, "%s/tmp/", confdir());
+#endif /* CYGWIN_HACKS */
+  clear_tmp();		/* clear out the tmp dir, no matter if we are localhub or not */
   /* just load everything now, won't matter if it's loaded if the bot has to suicide on startup */
   init_settings();
   hooks_init();