Fix warning about format string not being a string literal
This commit is contained in:
parent
f0cc213c5a
commit
df6e8ae046
55
src/stats.c
55
src/stats.c
@ -58,27 +58,9 @@ void init_stats (void)
|
|||||||
/*
|
/*
|
||||||
* Display the statics of the tinyproxy server.
|
* Display the statics of the tinyproxy server.
|
||||||
*/
|
*/
|
||||||
int showstats (struct conn_s *connptr)
|
int
|
||||||
|
showstats (struct conn_s *connptr)
|
||||||
{
|
{
|
||||||
static const char *msg =
|
|
||||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
|
|
||||||
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" "
|
|
||||||
"\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n"
|
|
||||||
"<html>\n"
|
|
||||||
"<head><title>%s version %s run-time statistics</title></head>\n"
|
|
||||||
"<body>\n"
|
|
||||||
"<h1>%s version %s run-time statistics</h1>\n"
|
|
||||||
"<p>\n"
|
|
||||||
"Number of open connections: %lu<br />\n"
|
|
||||||
"Number of requests: %lu<br />\n"
|
|
||||||
"Number of bad connections: %lu<br />\n"
|
|
||||||
"Number of denied connections: %lu<br />\n"
|
|
||||||
"Number of refused connections due to high load: %lu\n"
|
|
||||||
"</p>\n"
|
|
||||||
"<hr />\n"
|
|
||||||
"<p><em>Generated by %s version %s.</em></p>\n" "</body>\n"
|
|
||||||
"</html>\n";
|
|
||||||
|
|
||||||
char *message_buffer;
|
char *message_buffer;
|
||||||
char opens[16], reqs[16], badconns[16], denied[16], refused[16];
|
char opens[16], reqs[16], badconns[16], denied[16], refused[16];
|
||||||
FILE *statfile;
|
FILE *statfile;
|
||||||
@ -94,14 +76,33 @@ int showstats (struct conn_s *connptr)
|
|||||||
if (!message_buffer)
|
if (!message_buffer)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
snprintf (message_buffer, MAXBUFFSIZE, msg,
|
snprintf
|
||||||
PACKAGE, VERSION, PACKAGE, VERSION,
|
(message_buffer, MAXBUFFSIZE,
|
||||||
stats->num_open,
|
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
|
||||||
stats->num_reqs,
|
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" "
|
||||||
stats->num_badcons, stats->num_denied,
|
"\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n"
|
||||||
stats->num_refused, PACKAGE, VERSION);
|
"<html>\n"
|
||||||
|
"<head><title>%s version %s run-time statistics</title></head>\n"
|
||||||
|
"<body>\n"
|
||||||
|
"<h1>%s version %s run-time statistics</h1>\n"
|
||||||
|
"<p>\n"
|
||||||
|
"Number of open connections: %lu<br />\n"
|
||||||
|
"Number of requests: %lu<br />\n"
|
||||||
|
"Number of bad connections: %lu<br />\n"
|
||||||
|
"Number of denied connections: %lu<br />\n"
|
||||||
|
"Number of refused connections due to high load: %lu\n"
|
||||||
|
"</p>\n"
|
||||||
|
"<hr />\n"
|
||||||
|
"<p><em>Generated by %s version %s.</em></p>\n" "</body>\n"
|
||||||
|
"</html>\n",
|
||||||
|
PACKAGE, VERSION, PACKAGE, VERSION,
|
||||||
|
stats->num_open,
|
||||||
|
stats->num_reqs,
|
||||||
|
stats->num_badcons, stats->num_denied,
|
||||||
|
stats->num_refused, PACKAGE, VERSION);
|
||||||
|
|
||||||
if (send_http_message (connptr, 200, "OK", message_buffer) < 0) {
|
if (send_http_message (connptr, 200, "OK",
|
||||||
|
message_buffer) < 0) {
|
||||||
safefree (message_buffer);
|
safefree (message_buffer);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user