[PATCH v2] libio: Add test case for fflush

Florian Weimer fweimer@redhat.com
Thu Nov 7 10:06:59 GMT 2024


* Frederic Berat:

> On Thu, Nov 7, 2024 at 10:27 AM Florian Weimer <fweimer@redhat.com> wrote:
>
>  * Frederic Berat:
>
>  > On Wed, Nov 6, 2024 at 6:10 PM Florian Weimer <fweimer@redhat.com> wrote:
>  >
>  >  * Frédéric Bérat:
>  >
>  >  > I also tested the following:
>  >  >       char s[3] = "";
>  >  >       fgets (s, 2, FILE);
>  >  >       ungetc (s[1], FILE);
>  >  >       fflush (FILE);
>  >  >       pos = lseek (SEEK_CUR);
>  >  >
>  >  > Which gives a `pos` value of 2.

> Without unget:
> fgetc: Position in stream before fflush: 1424
> fgetc: Position in stream after fflush: 2

That's the only value 2 in the test, and it's using fgetc, not fgets?

Thanks,
Florian



More information about the Libc-alpha mailing list