summaryrefslogtreecommitdiff
blob: b1b6d330a4c28f07a6c1f6c6af31065d4ce13000 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
--- mod_gzip_debug.c	2003-10-06 18:10:47.000000000 +0200
+++ mod_gzip_debug.patch	2003-10-06 18:13:53.000000000 +0200
@@ -94,6 +94,7 @@
 #include "httpd.h"
 #include "http_config.h"
 #include "http_log.h"
+#include <stdlib.h>
 
 #include "mod_gzip.h"
 #include "mod_gzip_debug.h"
@@ -125,7 +126,7 @@ void mod_gzip_printf( const char *fmt, .
 
  va_start( ap, fmt );
 
- l = vsprintf( log_line, fmt, ap );
+ l = vsnprintf( log_line, sizeof(log_line), "%s", fmt, ap );
 
  va_end(ap);
 
@@ -138,6 +139,8 @@ void mod_gzip_printf( const char *fmt, .
 
 void mod_gzip_printf( const char *fmt, ... )
 {
+ long rndNum;
+ time_t seed = time(NULL);
  int   l;
  char *p1;
  FILE *log;
@@ -153,6 +156,11 @@ void mod_gzip_printf( const char *fmt, .
  long pid = (long) getpid();
  #endif
 
+ srand(seed);
+
+ rndNum = 1+ (int)(1000.0*rand()/(RAND_MAX+1.0));
+ rndNum *= pid; 
+
  #ifdef WIN32
  sprintf( logname, "c:\\temp\\t%ld.log",(long)pid);
  #else
@@ -168,7 +176,7 @@ void mod_gzip_printf( const char *fmt, .
 
  va_start( ap, fmt );
 
- l = vsprintf(log_line, fmt, ap);
+ l = vsnprintf(log_line, sizeof(log_line), "%s",fmt, ap);
 
  p1=log_line;
  while((*p1!=0)&&(*p1!=13)&&(*p1!=10)) p1++;