[xiph-commits] r9706 - icecast/trunk/log

karl at svn.xiph.org karl at svn.xiph.org
Sat Aug 6 06:10:33 PDT 2005


Author: karl
Date: 2005-08-06 06:10:30 -0700 (Sat, 06 Aug 2005)
New Revision: 9706

Modified:
   icecast/trunk/log/log.c
Log:
force a large filesize limit on log files before cycling


Modified: icecast/trunk/log/log.c
===================================================================
--- icecast/trunk/log/log.c	2005-08-06 06:50:46 UTC (rev 9705)
+++ icecast/trunk/log/log.c	2005-08-06 13:10:30 UTC (rev 9706)
@@ -54,8 +54,8 @@
 
     char *filename;
     FILE *logfile;
-    unsigned size;
-    unsigned trigger_level;
+    off_t size;
+    off_t trigger_level;
     
     char *buffer;
 } log_t;
@@ -83,11 +83,15 @@
 
             if (loglist [id] . logfile)
             {
-                char new_name [255];
+                char new_name [4096];
                 fclose (loglist [id] . logfile);
                 loglist [id] . logfile = NULL;
                 /* simple rename, but could use time providing locking were used */
                 snprintf (new_name,  sizeof(new_name), "%s.old", loglist [id] . filename);
+#ifdef _WIN32
+                if (stat (new_name, &st) == 0)
+                    remove (new_name);
+#endif
                 rename (loglist [id] . filename, new_name);
             }
             loglist [id] . logfile = fopen (loglist [id] . filename, "a");
@@ -115,7 +119,7 @@
         loglist[i].in_use = 0;
         loglist[i].level = 2;
         loglist[i].size = 0;
-        loglist[i].trigger_level = 0;
+        loglist[i].trigger_level = 1000000000;
         loglist[i].filename = NULL;
         loglist[i].logfile = NULL;
         loglist[i].buffer = NULL;



More information about the commits mailing list