Mail Archives: djgpp-workers/2000/08/31/00:48:27
On Thu, 31 Aug 2000, Jason Green wrote:
> I did actually think about this. fseek() and fread() are not listed
> (in the POSIX P.G.) as setting errno.
The DJGPP library always sets errno each time a system call (i.e., a
function of Int 21h via __dpmi_int) is made.
> To know that these functions
> will set errno requires inside knowledge of libc, so I played it safe.
>
> > > if errno != 0?
>
> It's not sufficient to simply test errno to see if an error occured,
> because it only has meaningful value if tested after a system call
> that has returned some failure indication.
The portable way to check for errno is to set it to zero before the
call to a function, then see if it is still zero after the function
returns.
> > But I agree that a more specific error message is a good idea.
>
> I don't see how it is possible to give more specific error messages,
I meant to say that adding strerror will result in more specific error
messages. Saying "read error: Bad file descriptor" is more
informative than just "read error", IMHO.
- Raw text -