On Fri, 2013-03-22 at 21:17 +0200, Tanu Kaskinen wrote:
> On Fri, 2013-03-22 at 19:43 +0100, David Henningsson wrote:
> > On 03/22/2013 07:00 PM, Tanu Kaskinen wrote:
> > > On Fri, 2013-03-22 at 15:37 +0100, David Henningsson wrote:
> > >> + while (!feof(f)) {
> > >> + if (!fgets(buf, sizeof(buf), f)) {
> > >> + fail_unless(feof(f));
> > >
> > > The loop condition is !feof(f), so this will always fail. The if could
> > > be replaced with fail_unless(fgets(buf, sizeof(buf), f));
> >
> > Eh, I don't think so?
>
> fgets() returns NULL in case there's an error or f is at EOF. The while
> condition just checked that f is not at EOF, therefore an error must
> have happened.
>
> > If you're sure, could you please correct the code in pa_config_parse
> > which works the same way?
>
> Done.
Uh, that was a bad idea. Now configuration file reading fails always. I
guess the EOF bit gets set only after there has been an attempt to read
more data than the file contains, so just reading the last byte isn't
sufficient.
--
Tanu
_______________________________________________
pulseaudio-discuss mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss