Re: [AD] errno = EINTR troubles - any unix experts? |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Sun, 2002-09-15 at 21:15, Ben Davis wrote:
> (I can't send to the list; plz forward this for me. Please change my e-mail
> address to entheh@xxxxxxxxxx if it appears anywhere.)
>
I'll just leave all of your text in this reply..
> > I read the libc section on EINTR, but i'm not sure what it means.
>
> My guess is that you get that value if the user presses Ctrl+C (and your
> program doesn't catch it). But that's only a guess.
No, there's no Ctrl+C. My libc docs say EINTR means a function is
"interrupted by an asynchronous signal" - whatever that meas.
> > And if
> > there's really a problem, it probably doesn't effect only datafiles, but
> > all stdio functions. Should a check for EINTR added to all stdio
> > functions in the packfile routines, and set errno to 0 if it sees EINTR?
>
> Allegro seems to claim that errno won't be set by successful function calls.
> Unfortunately, libc makes no such claim. You have to check return values,
> _then_ use errno to decide if an error has occurred. I don't know if the
> various Allegro developers were aware of the situation regarding errno; I
> certainly wasn't until it bit me.
>
> There is of course ferror(), which would be my preferred way of detecting an
> error. It'll return nozero if an error has occurred, zero if not. There's
> pack_ferror(), but that may be buggy...
>
> So maybe someone should go through the packfile stuff and check up on how
> errno is used... just a suggestion ;)
Yes, I'll probably try doing that in case no-one knows definitely what
is happening. I have one big datafile now which always fails, so I'll do
some more testing. Maybe I can find out exactly which function call sets
errno, and especially if it also has a return value indicating failure.
According to the libc docs, this would mean the function should be
repeated. So if e.g. fputc is failing, pack_fputc should repeat it (?)
if this is true.
> Ben
>
>
--
Elias Pschernig