[Freeswitch-branches] [commit] r5245 - freeswitch/branches/anthonyl/fs-branch/src/mod/loggers/mod_log2file

Freeswitch SVN anthonyl at freeswitch.org
Fri Jun 1 17:23:04 EDT 2007


Author: anthonyl
Date: Fri Jun  1 17:23:03 2007
New Revision: 5245

Modified:
   freeswitch/branches/anthonyl/fs-branch/src/mod/loggers/mod_log2file/mod_log2file.c

Log:
the apr file api rewrites nbytes on exit, so restore it to the default value before we move on.


Modified: freeswitch/branches/anthonyl/fs-branch/src/mod/loggers/mod_log2file/mod_log2file.c
==============================================================================
--- freeswitch/branches/anthonyl/fs-branch/src/mod/loggers/mod_log2file/mod_log2file.c	(original)
+++ freeswitch/branches/anthonyl/fs-branch/src/mod/loggers/mod_log2file/mod_log2file.c	Fri Jun  1 17:23:03 2007
@@ -181,14 +181,12 @@
 /* rotate the log file */
 static switch_status_t mod_log2file_rotate(void)
 {
-    int fd;
-    int ret;
-    unsigned int i;
-    unsigned char *p;
-    unsigned char *q;
-    switch_status_t stat;
-    switch_size_t   nbytes;
-    switch_file_t *l_afd;
+     unsigned int i = 0;
+    unsigned char *p = NULL;
+    unsigned char *q = NULL;
+    switch_status_t stat = 0;
+    switch_size_t   nbytes = 1024;
+    switch_file_t *l_afd = NULL;
     
     globals.log_size = 0;
     stat = switch_file_seek(globals.log_afd, APR_SET, 0);
@@ -217,12 +215,12 @@
         if (stat == SWITCH_STATUS_SUCCESS)
             break;
     }
-    nbytes = 1024;
     while ((stat = switch_file_read(&globals.log_afd, q, &nbytes)) == SWITCH_STATUS_SUCCESS) {
         switch_file_write(l_afd, q, &nbytes);
         memset(q, '\0', 1024);
+        nbytes = 1024;
     }
-    ret = fseek(globals.log_fd, 0, SEEK_SET);
+    /* ret = fseek(globals.log_fd, 0, SEEK_SET); replace me */
     free(p);
     free(q);
     return SWITCH_STATUS_SUCCESS;



More information about the Freeswitch-branches mailing list