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

Re: Broken alarm(3)



On Sun, Jun 12, 2005 at 06:41:25PM -0400, Alan Cox wrote:
> And writing to errno isn't allowed in C
It is allowed, actually.  C99 describes it as a "modifiable lvalue"
(OK, that's not explicit), footnote 170 says "a program that uses
errno for error checking should set it to zero before a library
function call" (OK, not normative).

Without setting errno to 0 it is impossible to detect e.g. range
errors in strtol () (as opposed to input string with value LONG_{MIN,MAX}).

SUSv3 explicitly talks about application assigning a value to errno;
it is also impossible to detect whether readdir () reached EOF or
encountered an error without errno modification.
	Mirek


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