]> git.pld-linux.org Git - packages/lighttpd.git/blame - lighttpd-mod_rrdtool-emptyfile.patch
- update to r2392 (PRE-RELEASE: 1.4.21-r2392)
[packages/lighttpd.git] / lighttpd-mod_rrdtool-emptyfile.patch
CommitLineData
935e15d5
ER
1--- lighttpd-1.4.20/src/mod_rrdtool.c~ 2008-07-30 22:38:32.000000000 +0300
2+++ lighttpd-1.4.20/src/mod_rrdtool.c 2008-10-07 13:27:54.472090759 +0300
3@@ -200,54 +200,58 @@
4 "not a regular file:", s->path_rrd);
5 return HANDLER_ERROR;
6 }
7- } else {
8- int r ;
9- /* create a new one */
10+ }
11
12- buffer_copy_string_len(p->cmd, CONST_STR_LEN("create "));
13- buffer_append_string_buffer(p->cmd, s->path_rrd);
14- buffer_append_string_len(p->cmd, CONST_STR_LEN(
15- " --step 60 "
16- "DS:InOctets:ABSOLUTE:600:U:U "
17- "DS:OutOctets:ABSOLUTE:600:U:U "
18- "DS:Requests:ABSOLUTE:600:U:U "
19- "RRA:AVERAGE:0.5:1:600 "
20- "RRA:AVERAGE:0.5:6:700 "
21- "RRA:AVERAGE:0.5:24:775 "
22- "RRA:AVERAGE:0.5:288:797 "
23- "RRA:MAX:0.5:1:600 "
24- "RRA:MAX:0.5:6:700 "
25- "RRA:MAX:0.5:24:775 "
26- "RRA:MAX:0.5:288:797 "
27- "RRA:MIN:0.5:1:600 "
28- "RRA:MIN:0.5:6:700 "
29- "RRA:MIN:0.5:24:775 "
30- "RRA:MIN:0.5:288:797\n"));
31+ /* still create DB if it's empty file */
32+ if (st.st_size > 0) {
33+ return HANDLER_GO_ON;
34+ }
35
36- if (-1 == (r = write(p->write_fd, p->cmd->ptr, p->cmd->used - 1))) {
37- log_error_write(srv, __FILE__, __LINE__, "ss",
38- "rrdtool-write: failed", strerror(errno));
39+ int r;
40+ /* create a new one */
41+ buffer_copy_string_len(p->cmd, CONST_STR_LEN("create "));
42+ buffer_append_string_buffer(p->cmd, s->path_rrd);
43+ buffer_append_string_len(p->cmd, CONST_STR_LEN(
44+ " --step 60 "
45+ "DS:InOctets:ABSOLUTE:600:U:U "
46+ "DS:OutOctets:ABSOLUTE:600:U:U "
47+ "DS:Requests:ABSOLUTE:600:U:U "
48+ "RRA:AVERAGE:0.5:1:600 "
49+ "RRA:AVERAGE:0.5:6:700 "
50+ "RRA:AVERAGE:0.5:24:775 "
51+ "RRA:AVERAGE:0.5:288:797 "
52+ "RRA:MAX:0.5:1:600 "
53+ "RRA:MAX:0.5:6:700 "
54+ "RRA:MAX:0.5:24:775 "
55+ "RRA:MAX:0.5:288:797 "
56+ "RRA:MIN:0.5:1:600 "
57+ "RRA:MIN:0.5:6:700 "
58+ "RRA:MIN:0.5:24:775 "
59+ "RRA:MIN:0.5:288:797\n"));
60+
61+ if (-1 == (r = write(p->write_fd, p->cmd->ptr, p->cmd->used - 1))) {
62+ log_error_write(srv, __FILE__, __LINE__, "ss",
63+ "rrdtool-write: failed", strerror(errno));
64
65- return HANDLER_ERROR;
66- }
67+ return HANDLER_ERROR;
68+ }
69
70- buffer_prepare_copy(p->resp, 4096);
71- if (-1 == (r = read(p->read_fd, p->resp->ptr, p->resp->size))) {
72- log_error_write(srv, __FILE__, __LINE__, "ss",
73- "rrdtool-read: failed", strerror(errno));
74+ buffer_prepare_copy(p->resp, 4096);
75+ if (-1 == (r = read(p->read_fd, p->resp->ptr, p->resp->size))) {
76+ log_error_write(srv, __FILE__, __LINE__, "ss",
77+ "rrdtool-read: failed", strerror(errno));
78
79- return HANDLER_ERROR;
80- }
81+ return HANDLER_ERROR;
82+ }
83
84- p->resp->used = r;
85+ p->resp->used = r;
86
87- if (p->resp->ptr[0] != 'O' ||
88- p->resp->ptr[1] != 'K') {
89- log_error_write(srv, __FILE__, __LINE__, "sbb",
90- "rrdtool-response:", p->cmd, p->resp);
91+ if (p->resp->ptr[0] != 'O' ||
92+ p->resp->ptr[1] != 'K') {
93+ log_error_write(srv, __FILE__, __LINE__, "sbb",
94+ "rrdtool-response:", p->cmd, p->resp);
95
96- return HANDLER_ERROR;
97- }
98+ return HANDLER_ERROR;
99 }
100
101 return HANDLER_GO_ON;
This page took 0.079686 seconds and 4 git commands to generate.