summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2012-10-10 13:35:27 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2012-10-10 13:37:48 +0200
commita5e394e469f7c3e4e40dd60da2ddc0294f485fdc (patch)
treefe14873da71aa09f96d8887327a2ad4f56999e0a
parenta99f912803e40db5c0f242a768c42508e6262b22 (diff)
Partially revert "src: remove unnecessary castings"
This partially reverts commit 6e8573c9f62fc9db99c120298d9539be27fe282e. %lu in 32-bits arch is only 4 bytes. Thanks to Jan Engelhardt for spotting this.
-rw-r--r--src/libnetfilter_acct.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libnetfilter_acct.c b/src/libnetfilter_acct.c
index f4dbf55..6a3a839 100644
--- a/src/libnetfilter_acct.c
+++ b/src/libnetfilter_acct.c
@@ -235,8 +235,10 @@ nfacct_snprintf_plain(char *buf, size_t rem, struct nfacct *nfacct,
if (flags & NFACCT_SNPRINTF_F_FULL) {
ret = snprintf(buf, rem,
- "{ pkts = %.20lu, bytes = %.20lu } = %s;",
+ "{ pkts = %.20llu, bytes = %.20llu } = %s;",
+ (unsigned long long)
nfacct_attr_get_u64(nfacct, NFACCT_ATTR_BYTES),
+ (unsigned long long)
nfacct_attr_get_u64(nfacct, NFACCT_ATTR_PKTS),
nfacct_attr_get_str(nfacct, NFACCT_ATTR_NAME));
} else {
@@ -294,10 +296,12 @@ nfacct_snprintf_xml(char *buf, size_t rem, struct nfacct *nfacct,
ret = snprintf(buf, rem,
"<obj><name>%s</name>"
- "<pkts>%.20lu</pkts>"
- "<bytes>%.20lu</bytes>",
+ "<pkts>%.20llu</pkts>"
+ "<bytes>%.20llu</bytes>",
nfacct_attr_get_str(nfacct, NFACCT_ATTR_NAME),
+ (unsigned long long)
nfacct_attr_get_u64(nfacct, NFACCT_ATTR_BYTES),
+ (unsigned long long)
nfacct_attr_get_u64(nfacct, NFACCT_ATTR_PKTS));
BUFFER_SIZE(ret, size, rem, offset);