[mythtv] audio write() error check
bjm at lvcm.com
Mon Nov 10 20:46:06 EST 2003
> You got my point. Sorry I did not explain my patch when sending it, I
> thought it was trivial.
> The idea was just that the test was always false and the useless and
> also that errors will never be caught.
Right, so I had it essentially backwards but the original code
was just so unfamiliar and awkward. That's probably why the
logic was horked in the first place. What I'd expect to see >99%
of the time would be:
while (written < size)
lw = write(audiofd, tmpbuf, size - written);
if (lw == -1)
cerr << "Error writing to audio device, exiting\n";
audiofd = -1;
written += lw;
tmpbuf += lw;
The write doesn't happen when written reaches size either way
so there was no need to put the write inside the while statement.
More information about the mythtv-dev