1 diff -urN bandwidthd-2.0.1/bandwidthd.c bandwidthd-2.0.1-new/bandwidthd.c
2 --- bandwidthd-2.0.1/bandwidthd.c 2005-01-11 22:27:26.000000000 +0100
3 +++ bandwidthd-2.0.1-new/bandwidthd.c 2005-01-18 21:42:56.000000000 +0100
8 - pidfile = fopen("/var/run/bandwidthd.pid", "wt");
9 + pidfile = fopen(PIDFILE, "wt");
12 if (fprintf(pidfile, "%d\n", pid) == 0)
14 - syslog(LOG_ERR, "Bandwidthd: failed to write '%d' to /var/run/bandwidthd.pid", pid);
15 + syslog(LOG_ERR, "Bandwidthd: failed to write '%d' to %s", pid, PIDFILE);
17 - unlink("/var/run/bandwidthd.pid");
24 - syslog(LOG_ERR, "Could not open /var/run/bandwidthd.pid for write");
25 + syslog(LOG_ERR, "Could not open %s for write", PIDFILE);
30 config.sensor_id = "unset";
32 openlog("bandwidthd", LOG_CONS, LOG_DAEMON);
35 - if (stat("./etc/bandwidthd.conf", &StatBuf))
36 + if (stat(CONFIG, &StatBuf))
39 - if (stat("./etc/bandwidthd.conf", &StatBuf))
40 + if (stat(CONFIG, &StatBuf))
42 - printf("Cannot find ./etc/bandwidthd.conf or %s/etc/bandwidthd.conf\n", INSTALL_DIR);
43 - syslog(LOG_ERR, "Cannot find ./etc/bandwidthd.conf or %s/etc/bandwidthd.conf", INSTALL_DIR);
44 + printf("Cannot find %s\n", CONFIG);
45 + syslog(LOG_ERR, "Cannot find %s", CONFIG);
50 - bdconfig_in = fopen("./etc/bandwidthd.conf", "rt");
51 + bdconfig_in = fopen(CONFIG, "rt");
54 - syslog(LOG_ERR, "Cannot open bandwidthd.conf");
55 - printf("Cannot open ./etc/bandwidthd.conf\n");
56 + syslog(LOG_ERR, "Cannot open %s", CONFIG);
57 + printf("Cannot open %s\n", CONFIG);
65 - bd_CollectingData("htdocs/index.html");
66 - bd_CollectingData("htdocs/index2.html");
67 - bd_CollectingData("htdocs/index3.html");
68 - bd_CollectingData("htdocs/index4.html");
69 + bd_CollectingData("index.html");
70 + bd_CollectingData("index2.html");
71 + bd_CollectingData("index3.html");
72 + bd_CollectingData("index4.html");
75 /* detach from console. */
76 diff -urN bandwidthd-2.0.1/bandwidthd.h bandwidthd-2.0.1-new/bandwidthd.h
77 --- bandwidthd-2.0.1/bandwidthd.h 2005-01-11 22:15:49.000000000 +0100
78 +++ bandwidthd-2.0.1-new/bandwidthd.h 2005-01-19 20:15:27.168848712 +0100
83 +#define PIDFILE "/var/run/bandwidthd.pid"
87 diff -urN bandwidthd-2.0.1/graph.c bandwidthd-2.0.1-new/graph.c
88 --- bandwidthd-2.0.1/graph.c 2005-01-11 22:15:49.000000000 +0100
89 +++ bandwidthd-2.0.1-new/graph.c 2005-01-18 21:44:37.000000000 +0100
92 int Counter, tCounter;
94 - char filename[] = "./htdocs/index2.html";
95 + char filename[] = "index2.html";
101 if (config.tag == '1')
103 - if ((file = fopen("./htdocs/index.html", "wt")) == NULL)
104 + if ((file = fopen("index.html", "wt")) == NULL)
106 - syslog(LOG_ERR, "Failed to open ./htdocs/index.html");
107 + syslog(LOG_ERR, "Failed to open %s/index.html", WWWROOT);
113 - filename[14] = config.tag;
114 + filename[strlen(filename) - 6] = config.tag;
115 if ((file = fopen(filename, "wt")) == NULL)
117 syslog(LOG_ERR, "Failed to open %s", filename);
119 for (SubnetCounter = 0; SubnetCounter < SubnetCount; SubnetCounter++)
121 HostIp2CharIp(SubnetTable[SubnetCounter].ip, Buffer1);
122 - sprintf(Buffer2, "./htdocs/Subnet-%c-%s.html", config.tag, Buffer1);
123 + sprintf(Buffer2, "Subnet-%c-%s.html", config.tag, Buffer1);
124 file = fopen(Buffer2, "wt");
125 fprintf(file, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n");
126 fprintf(file, "<HTML>\n<HEAD><TITLE>Bandwidthd - Subnet %s</TITLE>\n", Buffer1);
127 @@ -411,12 +411,12 @@
128 PrepareXAxis(im2, timestamp);
129 PrepareYAxis(im2, YMax);
131 - sprintf(outputfilename, "./htdocs/%s-%c-S.png", CharIp, config.tag);
132 + sprintf(outputfilename, "%s-%c-S.png", CharIp, config.tag);
133 OutputFile = fopen(outputfilename, "wb");
134 gdImagePng(im, OutputFile);
137 - sprintf(outputfilename, "./htdocs/%s-%c-R.png", CharIp, config.tag);
138 + sprintf(outputfilename, "%s-%c-R.png", CharIp, config.tag);
139 OutputFile = fopen(outputfilename, "wb");
140 gdImagePng(im2, OutputFile);
145 // The graph isn't worth clutering up the web pages with
146 - sprintf(outputfilename, "./htdocs/%s-%c-R.png", CharIp, config.tag);
147 + sprintf(outputfilename, "%s-%c-R.png", CharIp, config.tag);
148 unlink(outputfilename);
149 - sprintf(outputfilename, "./htdocs/%s-%c-S.png", CharIp, config.tag);
150 + sprintf(outputfilename, "%s-%c-S.png", CharIp, config.tag);
151 unlink(outputfilename);