libc6: sscanf: %llu doesn't work
Mario 'BitKoenig' Holbe
Mario.Holbe@RZ.TU-Ilmenau.DE
Thu, 6 Dec 2001 02:14:33 +0100
Package: libc6
Version: 2.2.4-6
Hoi,
in tracking down a problem with 'iptables', I found a problem
with the libc6 sscanf function, which I don't know, where to
address it to, so I hope, you know :)
It seems, the sscanf has a problem with the %llu conversion:
holbe@darkside:/home/holbe% cat te.c
#include <stdio.h>
int main(void) {
int r;
unsigned long long int bla = 0;
r = sscanf("1234 2345", "%lu", &bla);
printf("%i %llu\n", r, bla);
bla = 0;
r = sscanf("1234 2345", "%llu", &bla);
printf("%i %llu\n", r, bla);
bla = 0;
r = sscanf("1234 2345", "%Lu", &bla);
printf("%i %llu\n", r, bla);
return 0;
}
holbe@darkside:/home/holbe% cc -o te te.c
holbe@darkside:/home/holbe% ./te
1 1234
0 0
1 1234
holbe@darkside:/home/holbe%
The sscanf manpage says:
[...]
l Indicates either that the conversion will be one of
dioux or n and the next pointer is a pointer to a
long int (rather than int), or that the conversion
will be one of efg and the next pointer is a
pointer to double (rather than float). Specifying
two l flags is equivalent to the L flag.
L Indicates that the conversion will be either efg
and the next pointer is a pointer to long double or
the conversion will be dioux and the next pointer
is a pointer to long long. (Note that long long is
not an ANSI C type. Any program using this will not
be portable to all architectures).
The iptables binary is involved here with it's code for reading
counters for -c (--set-counters) option, which results in:
root@darkside:~# iptables -R INPUT 1 -c 10 100 -i lo -j RETURN
iptables v1.2.4: -c packet counter not numeric
I dunno, if it is a debian specific problem or a general libc6
problem or whatever and I hope, you know :)
Thanks for your work & regards,
Mario
PS: I'll CC: this mail to the linux netfilter users list because of
at least one unanswered question about a 'packet counter not numeric'
there :)
--
*axiom* welcher sensorische input bewirkte die output-aktion,
den irc-chatter mit dem nick "dus" des irc-servers
mittels eines kills zu verweisen?