add bandwidthd
[packages.git] / utils / bandwidthd / patches / 200-write_to_tmp_only
1 --- bandwidthd-2.0.1/graph.c.orig       2008-05-09 10:37:51.000000000 -0500
2 +++ bandwidthd-2.0.1/graph.c    2008-05-09 10:37:55.000000000 -0500
3 @@ -199,7 +199,7 @@
4         int SubnetCounter;
5         int Counter, tCounter;
6         time_t WriteTime;
7 -       char filename[] = "./htdocs/index2.html";
8 +       char filename[] = "/tmp/bandwidthd/index2.html";
9         char *PeriodDesc;
10         
11         FILE *file;
12 @@ -217,9 +217,9 @@
13         
14         if (config.tag == '1')
15                 {
16 -               if ((file = fopen("./htdocs/index.html", "wt")) == NULL)
17 +               if ((file = fopen("/tmp/bandwidthd/index.html", "wt")) == NULL)
18                         {
19 -                       syslog(LOG_ERR, "Failed to open ./htdocs/index.html");
20 +                       syslog(LOG_ERR, "Failed to open /tmp/bandwidthd/index.html");
21                         exit(1);
22                         }
23                 }
24 @@ -307,7 +307,7 @@
25         for (SubnetCounter = 0; SubnetCounter < SubnetCount; SubnetCounter++)
26                 {
27                 HostIp2CharIp(SubnetTable[SubnetCounter].ip, Buffer1);
28 -               sprintf(Buffer2, "./htdocs/Subnet-%c-%s.html", config.tag, Buffer1);
29 +               sprintf(Buffer2, "/tmp/bandwidthd/Subnet-%c-%s.html", config.tag, Buffer1);
30                 file = fopen(Buffer2, "wt");
31                 fprintf(file, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n");
32                 fprintf(file, "<HTML>\n<HEAD><TITLE>Bandwidthd - Subnet %s</TITLE>\n", Buffer1);
33 @@ -411,12 +411,12 @@
34          PrepareXAxis(im2, timestamp);
35          PrepareYAxis(im2, YMax);
36  
37 -        sprintf(outputfilename, "./htdocs/%s-%c-S.png", CharIp, config.tag);
38 +        sprintf(outputfilename, "/tmp/bandwidthd/%s-%c-S.png", CharIp, config.tag);
39          OutputFile = fopen(outputfilename, "wb");    
40          gdImagePng(im, OutputFile);
41          fclose(OutputFile);
42  
43 -        sprintf(outputfilename, "./htdocs/%s-%c-R.png", CharIp, config.tag);
44 +        sprintf(outputfilename, "/tmp/bandwidthd/%s-%c-R.png", CharIp, config.tag);
45          OutputFile = fopen(outputfilename, "wb");
46          gdImagePng(im2, OutputFile);
47          fclose(OutputFile);
48 @@ -424,9 +424,9 @@
49      else
50          {
51          // The graph isn't worth clutering up the web pages with
52 -        sprintf(outputfilename, "./htdocs/%s-%c-R.png", CharIp, config.tag);
53 +        sprintf(outputfilename, "/tmp/bandwidthd/%s-%c-R.png", CharIp, config.tag);
54          unlink(outputfilename);
55 -        sprintf(outputfilename, "./htdocs/%s-%c-S.png", CharIp, config.tag);
56 +        sprintf(outputfilename, "/tmp/bandwidthd/%s-%c-S.png", CharIp, config.tag);
57          unlink(outputfilename);
58          }
59  
60 --- bandwidthd-2.0.1/bandwidthd.c.orig  2008-05-09 10:06:37.000000000 -0500
61 +++ bandwidthd-2.0.1/bandwidthd.c       2008-05-09 10:38:55.000000000 -0500
62 @@ -333,10 +333,10 @@
63  
64         if (config.graph)
65                 {
66 -               bd_CollectingData("htdocs/index.html");
67 -               bd_CollectingData("htdocs/index2.html");
68 -               bd_CollectingData("htdocs/index3.html");
69 -               bd_CollectingData("htdocs/index4.html");
70 +               bd_CollectingData("/tmp/bandwidthd/index.html");
71 +               bd_CollectingData("/tmp/bandwidthd/index2.html");
72 +               bd_CollectingData("/tmp/bandwidthd/index3.html");
73 +               bd_CollectingData("/tmp/bandwidthd/index4.html");
74                 }
75  
76         /* detach from console. */