[Top][All Lists]

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

Re: [bug-gnulib] nit in strftime.c

From: Paul Eggert
Subject: Re: [bug-gnulib] nit in strftime.c
Date: Mon, 14 Mar 2005 15:25:19 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)

Jim Meyering <address@hidden> writes:

> The only explanation I can imagine for the pre-patched code is an
> assumption that this particular strftime call will always write
> into ubuf[0].  While that is reasonable, I don't see any guarantee
> of such behavior in the POSIX spec.

Unfortunately we cannot rely only on POSIX guarantees here, because
POSIX says that the contents of the output buffer are unspecified if
the output buffer is too small.  A failing POSIX strftime can set the
first byte of the output buffer to NUL.

That being said, I like that patch since it's more likely that
strftime won't arbitrarily set ubuf[0]=='\0'.  To save you the time I
installed the patch into gnulib and coreutils.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]