[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#571754: strftime("%c") crashes in (some) locations



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi,

Am So den 28. Feb 2010 um 10:39 schrieb Aurelien Jarno:
> >    setlocale(LC_ALL, "de_DE");
> >    tm = localtime(NULL);
> 
> This is wrong. localtime() doesn't accept a NULL pointer. You should
> call time(NULL), and pass the result to localtime().

Might be but this isn't the line where it crashes. Also it work's very
well filling the tm struct.

Note that the crash happens in the next line:
> >    strftime(time, sizeof(time), "%c", tm);

but only if the locale is set. This test program is only to demonstrate
the error in strftime, in the original program I get the value for tm
from other places (strptime).

But however, when rewriting the line to "tm = localtime(time(NULL));" I
get a compile error as there is no such function called time. Maybe
there is something really wrong with the eglibc?

Gruß
   Klaus
- -- 
Klaus Ethgen                            http://www.ethgen.de/
pub  2048R/D1A4EDE5 2000-02-26 Klaus Ethgen <Klaus@Ethgen.de>
Fingerprint: D7 67 71 C4 99 A6 D4 FE  EA 40 30 57 3C 88 26 2B
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEVAwUBS4pad5+OKpjRpO3lAQrQfwf/YBQtEC/MtrOPgkVyfvX4/hiJbzMhovX1
oAnU5hf0SqwOAhtfb9wyaORlU1uK9yC/zuYBo8APoOIgXAh9kPylN2qsCo9Mn4QF
ftczEb8n6UrmUoi5f4bj1/TFi1gXmC/vKgZpSHu8o9Dl0h+xQEBVtw8yreKCpfhQ
nrxkcTjKwJ2/WxywlHtrAGkbYZq+laodG0NegWIQBUJv4ZO8CbwpXsb4vHkoKbbJ
ORqCkgE2G2KbLmjHExjw6LDril4XWGNOpNYTym4WsYkdYeEDCW84cS6riiOwtiPe
GVRhfSzErLUU8m6TLU5wG+4NWV2iZs98+iQGLU4xeVe0Xc8hRgjGhA==
=+YYx
-----END PGP SIGNATURE-----



Reply to: