Message ID | 5135E977.1000905@googlemail.com |
---|---|
State | Superseded |
Headers | show |
On Tue, Mar 05, 2013 at 12:47:51PM +0000, Mr Dash Four wrote: > This patch fixes regressions present in v1.0.1, introduced as a result of > commit d17c772c98057b2cc0118274605d292809ff6b1e. > > Signed-off-by: Mr Dash Four <mr.dash.four@googlemail.com> > --- > src/nfacct.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/src/nfacct.c b/src/nfacct.c > index 4ce817d..21d4df8 100644 > --- a/src/nfacct.c > +++ b/src/nfacct.c > @@ -218,7 +218,8 @@ static int nfacct_cmd_list(int argc, char *argv[]) > return 0; > } > > -static int _nfacct_cmd_add(char *name, int pkts, int bytes) > +static int _nfacct_cmd_add(char *name, > + long long unsigned pkts, long long unsigned bytes) those are still signed, should be unsigned. > { > struct mnl_socket *nl; > char buf[MNL_SOCKET_BUFFER_SIZE]; > @@ -536,7 +537,7 @@ static int nfacct_cmd_restore(int argc, char *argv[]) > return -1; > } > *semicolon = 0; > - ret = sscanf(buffer, "{ pkts = %lu, bytes = %lu } = %s", > + ret = sscanf(buffer, "{ pkts = %llu, bytes = %llu } = %s", Better use %"PRIu64" given that we're using uint64_t. I have applied a patch based on yours. Thanks. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
>> -static int _nfacct_cmd_add(char *name, int pkts, int bytes) >> +static int _nfacct_cmd_add(char *name, >> + long long unsigned pkts, long long unsigned bytes) >> > > those are still signed, should be unsigned. > Noted. >> - ret = sscanf(buffer, "{ pkts = %lu, bytes = %lu } = %s", >> + ret = sscanf(buffer, "{ pkts = %llu, bytes = %llu } = %s", >> > > Better use %"PRIu64" given that we're using uint64_t. > You learn something new every day. If this is indeed the case, then another patch coming up in a minute. > I have applied a patch based on yours. > Thanks. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/src/nfacct.c b/src/nfacct.c index 4ce817d..21d4df8 100644 --- a/src/nfacct.c +++ b/src/nfacct.c @@ -218,7 +218,8 @@ static int nfacct_cmd_list(int argc, char *argv[]) return 0; } -static int _nfacct_cmd_add(char *name, int pkts, int bytes) +static int _nfacct_cmd_add(char *name, + long long unsigned pkts, long long unsigned bytes) { struct mnl_socket *nl; char buf[MNL_SOCKET_BUFFER_SIZE]; @@ -536,7 +537,7 @@ static int nfacct_cmd_restore(int argc, char *argv[]) return -1; } *semicolon = 0; - ret = sscanf(buffer, "{ pkts = %lu, bytes = %lu } = %s", + ret = sscanf(buffer, "{ pkts = %llu, bytes = %llu } = %s", &pkts, &bytes, name); if (ret != 3) { nfacct_perror("error reading input");
This patch fixes regressions present in v1.0.1, introduced as a result of commit d17c772c98057b2cc0118274605d292809ff6b1e. Signed-off-by: Mr Dash Four <mr.dash.four@googlemail.com> --- src/nfacct.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html