Sfoglia il codice sorgente

* Use "/tmp/" as the default tempdir and don't bother chmodding it (#32)

svn: 2043
Bryan Drewery 21 anni fa
parent
commit
eb7bdeee61
5 ha cambiato i file con 8 aggiunte e 7 eliminazioni
  1. 1 0
      doc/UPDATES
  2. 1 1
      src/conf.c
  3. 3 3
      src/main.c
  4. 2 2
      src/misc_file.c
  5. 1 1
      src/misc_file.h

+ 1 - 0
doc/UPDATES

@@ -96,6 +96,7 @@ Lines prefixxed with '-' were disabled before release and are not finishsed, or
 * botcmd * wasn't correctly being restricted to +n (#35)
 * Fixed cmd_mns_(ban|exempt|invite) to remove the proper ban if a number is used (#38)
 * Fixed cmd_stick/cmd_unstick not making leaf bots set/unset the masks in channels. (#41)
+* Use /tmp/ as the default tempdir until tempdir is read from config
 
 1.2.2
 * Don't sanity check flags for users on DCC CHAT if they are on the bot via .botcmd.

+ 1 - 1
src/conf.c

@@ -936,7 +936,7 @@ bin_to_conf(void)
   simple_snprintf(tempdir, DIRMAX, "tmp/");
 #endif /* CYGWIN_HACKS */
 
-  check_tempdir();      /* ensure we can access tmpdir if it changed */
+  check_tempdir(1);      /* ensure we can access tmpdir if it changed */
   clear_tmp();          /* clear out the tmp dir, no matter if we are localhub or not */
 
   conf_checkpids();

+ 3 - 3
src/main.c

@@ -668,13 +668,13 @@ printf("out: %s\n", out);
     fatal("!! Invalid binary", 0);
   }
 
-  /* setup initial tempdir as ./ until we read in tmpdir from conf */
+  /* setup initial tempdir as /tmp until we read in tmpdir from conf */
 
   binname = getfullbinname(argv[0]);
-  simple_snprintf(tempdir, sizeof(tempdir), "%s/", dirname(binname));
   chdir(dirname(binname));
 
-  check_tempdir();	/* make sure directory exists and we can access it */
+  simple_snprintf(tempdir, sizeof(tempdir), "/tmp/");
+  check_tempdir(0);	/* make sure directory exists and we can access it */
 
   /* This allows -2/-0 to be used without an initialized binary */
 //  if (!(argc == 2 && (!strcmp(argv[1], "-2") || !strcmp(argv[1], "0")))) {

+ 2 - 2
src/misc_file.c

@@ -204,7 +204,7 @@ Tempfile::~Tempfile()
   delete[] file;
 }
 
-void check_tempdir()
+void check_tempdir(bool do_chmod)
 {
   if (!can_stat(tempdir)) {
     if (mkdir(tempdir,  S_IRUSR | S_IWUSR | S_IXUSR)) {
@@ -214,7 +214,7 @@ void check_tempdir()
           werr(ERR_TMPSTAT);
     }
   }
-  if (fixmod(tempdir))
+  if (do_chmod && fixmod(tempdir))
     werr(ERR_TMPMOD);
 
   /* test tempdir: it's vital */

+ 1 - 1
src/misc_file.h

@@ -17,7 +17,7 @@ int can_lstat(const char *);
 int is_symlink(const char *);
 int is_dir(const char *);
 int fixmod(const char *);
-void check_tempdir();
+void check_tempdir(bool);
 
 class Tempfile 
 {