[Openvas-commits] r13739 - in trunk/openvas-scanner: . src

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Mon Jul 16 20:32:19 CEST 2012


Author: jan
Date: 2012-07-16 20:32:19 +0200 (Mon, 16 Jul 2012)
New Revision: 13739

Modified:
   trunk/openvas-scanner/ChangeLog
   trunk/openvas-scanner/src/log.c
Log:
Removed built-in logfile rotation. It is not a good idea to try
to circumvent system enviroment technology for logrotate.

* src/log.c (MAX_LOG_SIZE_MEGS, rotate_log_file): Removed.
(log_init): Removed call of rotate_log_file).



Modified: trunk/openvas-scanner/ChangeLog
===================================================================
--- trunk/openvas-scanner/ChangeLog	2012-07-16 15:54:01 UTC (rev 13738)
+++ trunk/openvas-scanner/ChangeLog	2012-07-16 18:32:19 UTC (rev 13739)
@@ -1,3 +1,11 @@
+2012-07-16  Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
+
+	Removed built-in logfile rotation. It is not a good idea to try
+	to circumvent system enviroment technology for logrotate.
+
+	* src/log.c (MAX_LOG_SIZE_MEGS, rotate_log_file): Removed.
+	(log_init): Removed call of rotate_log_file).
+
 2012-07-13  Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
 
 	* src/comm.c (comm_send_preferences): Removed deprectated prefs sind 3.0.

Modified: trunk/openvas-scanner/src/log.c
===================================================================
--- trunk/openvas-scanner/src/log.c	2012-07-16 15:54:01 UTC (rev 13738)
+++ trunk/openvas-scanner/src/log.c	2012-07-16 18:32:19 UTC (rev 13739)
@@ -41,42 +41,6 @@
 
 static FILE *log;
 
-#define MAX_LOG_SIZE_MEGS 500   /* 500 Megs */
-
-void
-rotate_log_file (const char *filename)
-{
-  char path[1024];
-  int i = 0;
-  struct stat st;
-
-  if (stat (filename, &st) == 0)
-    {
-      if (st.st_size < 1024 * 1024 * MAX_LOG_SIZE_MEGS)
-        return;
-    }
-  else
-    return;                     /* Could not stat the log file */
-
-
-  log_close ();
-
-  for (i = 0; i < 1024; i++)
-    {
-      int e;
-      snprintf (path, sizeof (path), "%s.%d", filename, i);
-      e = stat (path, &st);
-      if (e < 0 && errno == ENOENT)
-        break;
-    }
-
-  if (i == 1024)
-    return;                     /* ?? */
-
-  rename (filename, path);
-}
-
-
 /**
  * @brief Initialization of the log file.
  */
@@ -96,7 +60,6 @@
 
   else
     {
-      rotate_log_file (filename);
       int fd = open (filename, O_WRONLY | O_CREAT | O_APPEND
 #ifdef O_LARGEFILE
                      | O_LARGEFILE



More information about the Openvas-commits mailing list