]> git.pld-linux.org Git - packages/bandwidthd.git/blob - bandwidthd-path.patch
- tabs in preamble
[packages/bandwidthd.git] / bandwidthd-path.patch
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
4 @@ -209,20 +209,20 @@
5         {
6         FILE *pidfile;
7  
8 -       pidfile = fopen("/var/run/bandwidthd.pid", "wt");
9 +       pidfile = fopen(PIDFILE, "wt");
10         if (pidfile) 
11                 {
12                 if (fprintf(pidfile, "%d\n", pid) == 0) 
13                         {
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);
16                         fclose(pidfile);
17 -                       unlink("/var/run/bandwidthd.pid");
18 +                       unlink(PIDFILE);
19                         }
20                 else
21                         fclose(pidfile);                
22                 }
23         else
24 -               syslog(LOG_ERR, "Could not open /var/run/bandwidthd.pid for write");
25 +               syslog(LOG_ERR, "Could not open %s for write", PIDFILE);
26         }
27  
28  
29 @@ -254,23 +254,23 @@
30         config.sensor_id = "unset";  
31  
32         openlog("bandwidthd", LOG_CONS, LOG_DAEMON);
33 +       chdir(WWWROOT);
34  
35 -       if (stat("./etc/bandwidthd.conf", &StatBuf))
36 +       if (stat(CONFIG, &StatBuf))
37                 {
38 -               chdir(INSTALL_DIR);
39 -               if (stat("./etc/bandwidthd.conf", &StatBuf))
40 +               if (stat(CONFIG, &StatBuf))
41                         {
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);
46                         exit(1);
47                         }
48                 }
49  
50 -       bdconfig_in = fopen("./etc/bandwidthd.conf", "rt");
51 +       bdconfig_in = fopen(CONFIG, "rt");
52         if (!bdconfig_in)
53                 {
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);
58                 exit(1);
59                 }
60         bdconfig_parse();
61 @@ -333,10 +333,10 @@
62  
63         if (config.graph)
64                 {
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");
73                 }
74  
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
79 @@ -100,6 +100,7 @@
80  
81  #define DB_PGSQL 1
82  
83 +#define PIDFILE        "/var/run/bandwidthd.pid"
84  struct config
85         {
86         char *dev;
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
90 @@ -199,7 +199,7 @@
91         int SubnetCounter;
92         int Counter, tCounter;
93         time_t WriteTime;
94 -       char filename[] = "./htdocs/index2.html";
95 +       char filename[] = "index2.html";
96         char *PeriodDesc;
97         
98         FILE *file;
99 @@ -217,15 +217,15 @@
100         
101         if (config.tag == '1')
102                 {
103 -               if ((file = fopen("./htdocs/index.html", "wt")) == NULL)
104 +               if ((file = fopen("index.html", "wt")) == NULL)
105                         {
106 -                       syslog(LOG_ERR, "Failed to open ./htdocs/index.html");
107 +                       syslog(LOG_ERR, "Failed to open %s/index.html", WWWROOT);
108                         exit(1);
109                         }
110                 }
111         else
112                 {
113 -               filename[14] = config.tag;
114 +               filename[strlen(filename) - 6] = config.tag;
115                 if ((file = fopen(filename, "wt")) == NULL)
116                         {
117                         syslog(LOG_ERR, "Failed to open %s", filename);
118 @@ -307,7 +307,7 @@
119         for (SubnetCounter = 0; SubnetCounter < SubnetCount; SubnetCounter++)
120                 {
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);
130  
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);
135          fclose(OutputFile);
136  
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);
141          fclose(OutputFile);
142 @@ -424,9 +424,9 @@
143      else
144          {
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);
152          }
153  
This page took 0.061956 seconds and 3 git commands to generate.