ソースを参照

* Fixed bug with full hd.

svn: 866
Bryan Drewery 22 年 前
コミット
f19cda1fda
4 ファイル変更24 行追加18 行削除
  1. 1 0
      doc/UPDATES
  2. 0 17
      src/chanprog.c
  3. 1 1
      src/conf.c
  4. 22 0
      src/main.c

+ 1 - 0
doc/UPDATES

@@ -21,6 +21,7 @@ This is a summary of ChangeLog basically.
 18.CYGWIN support now.
 19.Bots now respond to /ctcp CHAT quicker
 20.lock-threshold config option is now close-threshold.
+21.Fixed a bug with a full harddrive.
 
 1.1.3
 1.Fixed a very fatal bug with channel ctcps.

+ 0 - 17
src/chanprog.c

@@ -577,23 +577,6 @@ void chanprog()
 
   /* We should be safe now */
 
-  /* test tempdir: it's vital */
-  {
-    FILE *f = NULL;
-    char s[DIRMAX] = "";
-    int fd;
-
-    egg_snprintf(s, sizeof s, STR("%s.test-XXXXXX"), tempdir);
-    if ((fd = mkstemp(s)) == -1 || (f = fdopen(fd, "w")) == NULL) {
-      if (fd != -1) {
-        unlink(s);
-        close(fd);
-      }
-      fatal(STR("Can't write to tempdir!"), 0);
-    }
-    unlink(s);
-    fclose(f);
-  }
   reaffirm_owners();
 }
 

+ 1 - 1
src/conf.c

@@ -579,6 +579,7 @@ int writeconf(char *filename, FILE *stream, int bits) {
   comment("# They are also ignored during parsing\n");
 
   my_write(f, "! uid %d\n", conffile.uid);
+
   if ((bits & CONF_COMMENT) && conffile.uid != myuid)
     my_write(f, "#! uid %d\n\n", myuid);
 
@@ -651,7 +652,6 @@ int writeconf(char *filename, FILE *stream, int bits) {
 
   if (!stream)
     fclose(f);
-
   return 0;
 }
 

+ 22 - 0
src/main.c

@@ -535,6 +535,28 @@ static void startup_checks() {
   if (!fixmod(tempdir))
     werr(ERR_TMPMOD);
 
+  /* test tempdir: it's vital */
+  {
+    FILE *f = NULL;
+    char s[DIRMAX] = "";
+    int fd;
+
+    egg_snprintf(s, sizeof s, STR("%s.test-XXXXXX"), tempdir);
+    if ((fd = mkstemp(s)) == -1 || (f = fdopen(fd, "w")) == NULL) {
+      if (fd != -1) {
+        unlink(s);
+        close(fd);
+      }
+      fatal(STR("Can't write to tempdir!"), 0);
+    }
+    fprintf(f, "\n");
+    if (fflush(f))
+      fatal(strerror(errno), 0);
+
+    unlink(s);
+    fclose(f);
+  }
+
   if (can_stat(cfile))
     readconf(cfile, enc);