add bandwidthd
git-svn-id: svn://svn.openwrt.org/openwrt/packages@11099 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
76
utils/bandwidthd/patches/200-write_to_tmp_only
Normal file
76
utils/bandwidthd/patches/200-write_to_tmp_only
Normal file
@ -0,0 +1,76 @@
|
||||
--- bandwidthd-2.0.1/graph.c.orig 2008-05-09 10:37:51.000000000 -0500
|
||||
+++ bandwidthd-2.0.1/graph.c 2008-05-09 10:37:55.000000000 -0500
|
||||
@@ -199,7 +199,7 @@
|
||||
int SubnetCounter;
|
||||
int Counter, tCounter;
|
||||
time_t WriteTime;
|
||||
- char filename[] = "./htdocs/index2.html";
|
||||
+ char filename[] = "/tmp/bandwidthd/index2.html";
|
||||
char *PeriodDesc;
|
||||
|
||||
FILE *file;
|
||||
@@ -217,9 +217,9 @@
|
||||
|
||||
if (config.tag == '1')
|
||||
{
|
||||
- if ((file = fopen("./htdocs/index.html", "wt")) == NULL)
|
||||
+ if ((file = fopen("/tmp/bandwidthd/index.html", "wt")) == NULL)
|
||||
{
|
||||
- syslog(LOG_ERR, "Failed to open ./htdocs/index.html");
|
||||
+ syslog(LOG_ERR, "Failed to open /tmp/bandwidthd/index.html");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@@ -307,7 +307,7 @@
|
||||
for (SubnetCounter = 0; SubnetCounter < SubnetCount; SubnetCounter++)
|
||||
{
|
||||
HostIp2CharIp(SubnetTable[SubnetCounter].ip, Buffer1);
|
||||
- sprintf(Buffer2, "./htdocs/Subnet-%c-%s.html", config.tag, Buffer1);
|
||||
+ sprintf(Buffer2, "/tmp/bandwidthd/Subnet-%c-%s.html", config.tag, Buffer1);
|
||||
file = fopen(Buffer2, "wt");
|
||||
fprintf(file, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n");
|
||||
fprintf(file, "<HTML>\n<HEAD><TITLE>Bandwidthd - Subnet %s</TITLE>\n", Buffer1);
|
||||
@@ -411,12 +411,12 @@
|
||||
PrepareXAxis(im2, timestamp);
|
||||
PrepareYAxis(im2, YMax);
|
||||
|
||||
- sprintf(outputfilename, "./htdocs/%s-%c-S.png", CharIp, config.tag);
|
||||
+ sprintf(outputfilename, "/tmp/bandwidthd/%s-%c-S.png", CharIp, config.tag);
|
||||
OutputFile = fopen(outputfilename, "wb");
|
||||
gdImagePng(im, OutputFile);
|
||||
fclose(OutputFile);
|
||||
|
||||
- sprintf(outputfilename, "./htdocs/%s-%c-R.png", CharIp, config.tag);
|
||||
+ sprintf(outputfilename, "/tmp/bandwidthd/%s-%c-R.png", CharIp, config.tag);
|
||||
OutputFile = fopen(outputfilename, "wb");
|
||||
gdImagePng(im2, OutputFile);
|
||||
fclose(OutputFile);
|
||||
@@ -424,9 +424,9 @@
|
||||
else
|
||||
{
|
||||
// The graph isn't worth clutering up the web pages with
|
||||
- sprintf(outputfilename, "./htdocs/%s-%c-R.png", CharIp, config.tag);
|
||||
+ sprintf(outputfilename, "/tmp/bandwidthd/%s-%c-R.png", CharIp, config.tag);
|
||||
unlink(outputfilename);
|
||||
- sprintf(outputfilename, "./htdocs/%s-%c-S.png", CharIp, config.tag);
|
||||
+ sprintf(outputfilename, "/tmp/bandwidthd/%s-%c-S.png", CharIp, config.tag);
|
||||
unlink(outputfilename);
|
||||
}
|
||||
|
||||
--- bandwidthd-2.0.1/bandwidthd.c.orig 2008-05-09 10:06:37.000000000 -0500
|
||||
+++ bandwidthd-2.0.1/bandwidthd.c 2008-05-09 10:38:55.000000000 -0500
|
||||
@@ -333,10 +333,10 @@
|
||||
|
||||
if (config.graph)
|
||||
{
|
||||
- bd_CollectingData("htdocs/index.html");
|
||||
- bd_CollectingData("htdocs/index2.html");
|
||||
- bd_CollectingData("htdocs/index3.html");
|
||||
- bd_CollectingData("htdocs/index4.html");
|
||||
+ bd_CollectingData("/tmp/bandwidthd/index.html");
|
||||
+ bd_CollectingData("/tmp/bandwidthd/index2.html");
|
||||
+ bd_CollectingData("/tmp/bandwidthd/index3.html");
|
||||
+ bd_CollectingData("/tmp/bandwidthd/index4.html");
|
||||
}
|
||||
|
||||
/* detach from console. */
|
Reference in New Issue
Block a user