Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: mkdir builtin and $'\0'
On Tue, Aug 18, 2015 at 5:07 PM, Peter Stephenson
<p.stephenson@xxxxxxxxxxx> wrote:
> On Tue, 18 Aug 2015 15:21:45 +0100
> Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote:
>> This seems to work for strftime and primt -P %D and the tests pass.
>
> I think there's a pre-existing confusion here, which is that we should
> really treat ztrftime return value of both 0 and -1 as failure. The 0
> comes from strftime(), which returns the number of characters it's
> succesfully converted (the manual helpfully says 0 "doesn't necessarily
> indicate an error", just that it coverted nothing); the -1 was a local
> enhancement.
>
> I'll fix this locally before submitting.
I'm not sure what part of the code this is in reference to exactly,
but we only call strftime in one place so I suppose that place. You
saw this comment above the function?
/*
Like the system function, this returns the number of characters
copied, not including the terminating NUL. This may be zero if the
string didn't fit.
As an extension, try to detect an error in strftime --- typically not
enough memory --- and return -1. Not guaranteed to be portable, since
the strftime() interface doesn't make any guarantees about the state
of the buffer if it returns zero.
*/
It's not clear to me what "I'll fix this" implies, either :). If you
call strftime with an empty format string for example, I'm pretty sure
it'll return 0 but there was no error.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author