summaryrefslogtreecommitdiff
path: root/accel-pppd
diff options
context:
space:
mode:
authorGuillaume Nault <g.nault@alphalink.fr>2012-09-04 20:29:18 +0200
committerKozlov Dmitry <xeb@mail.ru>2012-09-05 22:35:48 +0400
commitb4eec284b0814c01c575492af73dbe23ff81f5e8 (patch)
treed0bb188f1cd694f773b0cf26e00f4e2205311951 /accel-pppd
parentfdeeb6f8547617a0478ffe847b76c46fa45487d0 (diff)
downloadaccel-ppp-b4eec284b0814c01c575492af73dbe23ff81f5e8.tar.gz
accel-ppp-b4eec284b0814c01c575492af73dbe23ff81f5e8.zip
Fix format string errors
Fix several errors and compiler warnings in format string arguments. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Diffstat (limited to 'accel-pppd')
-rw-r--r--accel-pppd/auth/auth_mschap_v2.c4
-rw-r--r--accel-pppd/cli/std_cmd.c10
-rw-r--r--accel-pppd/ctrl/l2tp/packet.c2
-rw-r--r--accel-pppd/ctrl/pppoe/cli.c2
-rw-r--r--accel-pppd/ctrl/pppoe/pppoe.c2
-rw-r--r--accel-pppd/ctrl/pptp/pptp.c3
-rw-r--r--accel-pppd/extra/connlimit.c11
-rw-r--r--accel-pppd/ipv6/dhcpv6.c3
-rw-r--r--accel-pppd/logs/log_file.c2
-rw-r--r--accel-pppd/ppp/ppp_lcp.c2
-rw-r--r--accel-pppd/radius/serv.c4
11 files changed, 23 insertions, 22 deletions
diff --git a/accel-pppd/auth/auth_mschap_v2.c b/accel-pppd/auth/auth_mschap_v2.c
index b8f346aa..444a9df2 100644
--- a/accel-pppd/auth/auth_mschap_v2.c
+++ b/accel-pppd/auth/auth_mschap_v2.c
@@ -205,7 +205,7 @@ static void chap_send_failure(struct chap_auth_data_t *ad, char *mschap_error, c
sprintf((char *)(hdr + 1), "%s M=%s", mschap_error, reply_msg);
if (conf_ppp_verbose)
- log_ppp_info2("send [MSCHAP-v2 Failure id=%x \"%s\"]\n", hdr->id, hdr + 1);
+ log_ppp_info2("send [MSCHAP-v2 Failure id=%x \"%s\"]\n", hdr->id, (char *)(hdr + 1));
ppp_chan_send(ad->ppp, hdr, ntohs(hdr->len) + 2);
@@ -223,7 +223,7 @@ static void chap_send_success(struct chap_auth_data_t *ad, struct chap_response_
sprintf((char *)(hdr + 1), "S=%s M=%s", authenticator, conf_msg_success);
if (conf_ppp_verbose)
- log_ppp_info2("send [MSCHAP-v2 Success id=%x \"%s\"]\n", hdr->id, hdr + 1);
+ log_ppp_info2("send [MSCHAP-v2 Success id=%x \"%s\"]\n", hdr->id, (char *)(hdr + 1));
ppp_chan_send(ad->ppp, hdr, ntohs(hdr->len) + 2);
diff --git a/accel-pppd/cli/std_cmd.c b/accel-pppd/cli/std_cmd.c
index 01e01571..d2666d87 100644
--- a/accel-pppd/cli/std_cmd.c
+++ b/accel-pppd/cli/std_cmd.c
@@ -44,15 +44,15 @@ static int show_stat_exec(const char *cmd, char * const *fields, int fields_cnt,
hour = dt / (60 * 60);
dt %= 60 * 60;
- cli_sendv(client, "uptime: %i.%02i:%02i:%02i\r\n", day, hour, dt / 60, dt % 60);
+ cli_sendv(client, "uptime: %i.%02i:%02lu:%02lu\r\n", day, hour, dt / 60, dt % 60);
cli_sendv(client, "cpu: %i%%\r\n", triton_stat.cpu);
#ifdef MEMDEBUG
cli_send(client, "memory:\r\n");
cli_sendv(client, " rss/virt: %lu/%lu kB\r\n", vmrss * page_size_kb, vmsize * page_size_kb);
- cli_sendv(client, " arena: %lu kB\r\n", mi.arena / 1024);
- cli_sendv(client, " mmaped: %lu kB\r\n", mi.hblkhd / 1024);
- cli_sendv(client, " uordblks: %lu kB\r\n", mi.uordblks / 1024);
- cli_sendv(client, " fordblks: %lu kB\r\n", mi.fordblks / 1024);
+ cli_sendv(client, " arena: %i kB\r\n", mi.arena / 1024);
+ cli_sendv(client, " mmaped: %i kB\r\n", mi.hblkhd / 1024);
+ cli_sendv(client, " uordblks: %i kB\r\n", mi.uordblks / 1024);
+ cli_sendv(client, " fordblks: %i kB\r\n", mi.fordblks / 1024);
#else
cli_sendv(client, "mem(rss/virt): %lu/%lu kB\r\n", vmrss * page_size_kb, vmsize * page_size_kb);
#endif
diff --git a/accel-pppd/ctrl/l2tp/packet.c b/accel-pppd/ctrl/l2tp/packet.c
index 60b9d36c..70d8d5d9 100644
--- a/accel-pppd/ctrl/l2tp/packet.c
+++ b/accel-pppd/ctrl/l2tp/packet.c
@@ -158,7 +158,7 @@ int l2tp_recv(int fd, struct l2tp_packet_t **p, struct in_pktinfo *pkt_info)
if (n < sizeof(*hdr)) {
if (conf_verbose)
- log_warn("l2tp: short packet received (%i/%i)\n", n, sizeof(*hdr));
+ log_warn("l2tp: short packet received (%i/%zu)\n", n, sizeof(*hdr));
goto out_err_hdr;
}
diff --git a/accel-pppd/ctrl/pppoe/cli.c b/accel-pppd/ctrl/pppoe/cli.c
index 847b8547..26846402 100644
--- a/accel-pppd/ctrl/pppoe/cli.c
+++ b/accel-pppd/ctrl/pppoe/cli.c
@@ -120,7 +120,7 @@ static int show_service_name_exec(const char *cmd, char * const *f, int f_cnt, v
if (conf_service_name)
cli_sendv(cli, "%s\r\n", conf_service_name);
else
- cli_sendv(cli, "*\r\n", conf_service_name);
+ cli_sendv(cli, "*\r\n");
return CLI_CMD_OK;
}
diff --git a/accel-pppd/ctrl/pppoe/pppoe.c b/accel-pppd/ctrl/pppoe/pppoe.c
index b0734c8f..22fcd62f 100644
--- a/accel-pppd/ctrl/pppoe/pppoe.c
+++ b/accel-pppd/ctrl/pppoe/pppoe.c
@@ -1351,7 +1351,7 @@ static int init_secret(struct pppoe_serv_t *serv)
DES_cblock key;
if (read(urandom_fd, serv->secret, SECRET_LENGTH) < 0) {
- log_emerg("pppoe: failed to read /dev/urandom\n", strerror(errno));
+ log_emerg("pppoe: failed to read /dev/urandom: %s\n", strerror(errno));
return -1;
}
diff --git a/accel-pppd/ctrl/pptp/pptp.c b/accel-pppd/ctrl/pptp/pptp.c
index 0fef12f4..c00f29ff 100644
--- a/accel-pppd/ctrl/pptp/pptp.c
+++ b/accel-pppd/ctrl/pptp/pptp.c
@@ -1,3 +1,4 @@
+#include <inttypes.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
@@ -221,7 +222,7 @@ static int pptp_start_ctrl_conn_rqst(struct pptp_conn_t *conn)
}
if (msg->version != htons(PPTP_VERSION)) {
- log_ppp_warn("PPTP version mismatch: expecting %x, received %s\n", PPTP_VERSION, msg->version);
+ log_ppp_warn("PPTP version mismatch: expecting %x, received %" PRIu32 "\n", PPTP_VERSION, msg->version);
if (send_pptp_start_ctrl_conn_rply(conn, PPTP_CONN_RES_PROTOCOL, 0))
return -1;
return 0;
diff --git a/accel-pppd/extra/connlimit.c b/accel-pppd/extra/connlimit.c
index dcfc2deb..fd7c952b 100644
--- a/accel-pppd/extra/connlimit.c
+++ b/accel-pppd/extra/connlimit.c
@@ -1,3 +1,4 @@
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -38,7 +39,7 @@ int __export connlimit_check(uint64_t key)
clock_gettime(CLOCK_MONOTONIC, &ts);
pthread_mutex_lock(&lock);
- log_debug("connlimit: check entry %llu\n", key);
+ log_debug("connlimit: check entry %" PRIu64 "\n", key);
list_for_each_safe(pos, n, &items) {
it = list_entry(pos, typeof(*it), entry);
@@ -66,7 +67,7 @@ int __export connlimit_check(uint64_t key)
}
if (d > conf_burst_timeout) {
- log_debug("connlimit: remove %llu\n", it->key);
+ log_debug("connlimit: remove %" PRIu64 "\n", it->key);
list_move(&it->entry, &tmp_list);
}
}
@@ -78,7 +79,7 @@ int __export connlimit_check(uint64_t key)
it->ts = ts;
it->key = key;
- log_debug("connlimit: add entry %llu\n", key);
+ log_debug("connlimit: add entry %" PRIu64 "\n", key);
pthread_mutex_lock(&lock);
list_add(&it->entry, &items);
@@ -88,9 +89,9 @@ int __export connlimit_check(uint64_t key)
}
if (r == 0)
- log_debug("connlimit: accept %llu\n", key);
+ log_debug("connlimit: accept %" PRIu64 "\n", key);
else
- log_debug("connlimit: drop %llu\n", key);
+ log_debug("connlimit: drop %" PRIu64 "\n", key);
while (!list_empty(&tmp_list)) {
diff --git a/accel-pppd/ipv6/dhcpv6.c b/accel-pppd/ipv6/dhcpv6.c
index 9160a750..5c6d1a52 100644
--- a/accel-pppd/ipv6/dhcpv6.c
+++ b/accel-pppd/ipv6/dhcpv6.c
@@ -173,7 +173,8 @@ static void insert_dp_routes(struct ap_session *ses, struct dhcpv6_pd *pd)
if (ioctl(sock6_fd, SIOCADDRT, &rt6)) {
err = errno;
inet_ntop(AF_INET6, &p->addr, str1, sizeof(str1));
- log_ppp_error("dhcpv6: route add %s/%i: %s\n", str1, p->prefix_len);
+ log_ppp_error("dhcpv6: route add %s/%i: %s\n",
+ str1, p->prefix_len, strerror(err));
} else if (conf_verbose) {
inet_ntop(AF_INET6, &p->addr, str1, sizeof(str1));
log_ppp_info2("dhcpv6: route add %s/%i\n", str1, p->prefix_len);
diff --git a/accel-pppd/logs/log_file.c b/accel-pppd/logs/log_file.c
index 6dd7203b..3a618237 100644
--- a/accel-pppd/logs/log_file.c
+++ b/accel-pppd/logs/log_file.c
@@ -201,7 +201,6 @@ overrun:
static void send_next_chunk(void)
{
struct log_file_t *lf;
- int n;
spin_lock(&lf_queue_lock);
if (list_empty(&lf_queue)) {
@@ -211,7 +210,6 @@ static void send_next_chunk(void)
}
lf = list_entry(lf_queue.next, typeof(*lf), entry);
- n = log_file->entry.next == NULL;
list_del(&lf->entry);
spin_unlock(&lf_queue_lock);
diff --git a/accel-pppd/ppp/ppp_lcp.c b/accel-pppd/ppp/ppp_lcp.c
index f3e82270..1b47cad5 100644
--- a/accel-pppd/ppp/ppp_lcp.c
+++ b/accel-pppd/ppp/ppp_lcp.c
@@ -860,7 +860,7 @@ static void lcp_recv(struct ppp_handler_t*h)
break;
case PROTOREJ:
if (conf_ppp_verbose)
- log_ppp_info2("recv [LCP ProtoRej id=%x <%04x>]\n", hdr->code, hdr->id, ntohs(*(uint16_t*)(hdr + 1)));
+ log_ppp_info2("recv [LCP ProtoRej id=%x <%04x>]\n", hdr->id, ntohs(*(uint16_t*)(hdr + 1)));
ppp_recv_proto_rej(lcp->ppp, ntohs(*(uint16_t *)(hdr + 1)));
break;
case IDENT:
diff --git a/accel-pppd/radius/serv.c b/accel-pppd/radius/serv.c
index f40725b9..ff354e54 100644
--- a/accel-pppd/radius/serv.c
+++ b/accel-pppd/radius/serv.c
@@ -237,8 +237,8 @@ static void show_stat(struct rad_server_t *s, void *client)
cli_sendv(client, " fail count: %lu\r\n", s->stat_fail_cnt);
}
- cli_sendv(client, " request count: %lu\r\n", s->req_cnt);
- cli_sendv(client, " queue length: %lu\r\n", s->queue_cnt);
+ cli_sendv(client, " request count: %i\r\n", s->req_cnt);
+ cli_sendv(client, " queue length: %i\r\n", s->queue_cnt);
if (s->auth_port) {
cli_sendv(client, " auth sent: %lu\r\n", s->stat_auth_sent);