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

Re: Switch on compiler hardening defaults

On Sun, Nov 01, 2009 at 08:10:44PM +0100, Samuel Thibault wrote:

> > In general you cannot rely on checking errno because it is not defined
> > whether a successful operation clears it.
> But you can clear it by hand before calling them.

That's only true in some special cases; for example, SuSv3 says you
should manually clear errno before calling functions in <math.h> and you
should check errno to see if the function was successful. But otherwise,
even a successful operation may have called other operations internally
that have failed and thus have modified errno.


     MTA SZTAKI Computer and Automation Research Institute
                Hungarian Academy of Sciences

Reply to: