zsh-workers
 help / color / mirror / code / Atom feed
* Re: segfault in strftime
       [not found]         ` <201002261645.o1QGji9R022432@news01.csr.com>
@ 2010-02-26 17:47           ` Bart Schaefer
  2010-02-26 22:45             ` Vincent Lefevre
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Schaefer @ 2010-02-26 17:47 UTC (permalink / raw)
  To: zsh-workers

[>workers]

On Feb 26,  4:45pm, Peter Stephenson wrote:
} Subject: Re: segfault in strftime
}
} Vincent Lefevre wrote:
} > Wouldn't it be better to test only errno != 0 ?
} 
} Well, given we're setting it to 0 beforehand that seems reasonable.

That's *probably* safe in this case ... but in general I don't think
so.  The standards make no guarantee about the value of errno in the
case where the library call returns "successfully" (however that may
be defined) -- that is, the implementation is allowed to set errno
to what the next upcoming error *might* be, and is not required to
then clear errno before returning success.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: segfault in strftime
  2010-02-26 17:47           ` segfault in strftime Bart Schaefer
@ 2010-02-26 22:45             ` Vincent Lefevre
  0 siblings, 0 replies; 2+ messages in thread
From: Vincent Lefevre @ 2010-02-26 22:45 UTC (permalink / raw)
  To: zsh-workers

On 2010-02-26 09:47:31 -0800, Bart Schaefer wrote:
> That's *probably* safe in this case ... but in general I don't think
> so.  The standards make no guarantee about the value of errno in the
> case where the library call returns "successfully" (however that may
> be defined) -- that is, the implementation is allowed to set errno
> to what the next upcoming error *might* be, and is not required to
> then clear errno before returning success.

It is safe for functions that use errno: "The value of errno may
be set to nonzero by a library function call whether or not there
is an error, provided the use of errno is not documented in the
description of the function in this International Standard."

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-02-26 22:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <A73C7D9C-66C5-4BFA-8FB3-8560FE65B529@biskalar.de>
     [not found] ` <20100226125256.GC13766@prunille.vinc17.org>
     [not found]   ` <20100226150748.GE13766@prunille.vinc17.org>
     [not found]     ` <20100226151712.05fbe555@news01>
     [not found]       ` <20100226162130.GF13766@prunille.vinc17.org>
     [not found]         ` <201002261645.o1QGji9R022432@news01.csr.com>
2010-02-26 17:47           ` segfault in strftime Bart Schaefer
2010-02-26 22:45             ` Vincent Lefevre

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).