[PATCH] libio: use stdout in puts and putchar, etc [BZ #24051].
Florian Weimer
fweimer@redhat.com
Thu Jan 3 13:08:00 GMT 2019
* Paul Pluzhnikov:
> diff --git a/libio/tst-bz24051.c b/libio/tst-bz24051.c
> new file mode 100644
> index 0000000000..52c7a64b5b
> --- /dev/null
> +++ b/libio/tst-bz24051.c
> @@ -0,0 +1,79 @@
> +/* Prevent putchar -> _IO_putc inline expansion. */
> +#define __NO_INLINE__
#pragma GCC optimize ("O0") seems prudent here as well, to inhibit any
printf uptimizations.
> + rewind (stdout);
> + TEST_VERIFY_EXIT (fgetws (buf, sizeof (buf), stdout) != NULL);
> + TEST_VERIFY (wcscmp (buf, L"abcdef") == 0);
You should use array_length (buf) here (and include <array_length.h>).
fgetws does not expect a ybte byte count.
Rest of the patch looks okay to me. (Siddhesh needs to ack this because
of the freeze.)
Thanks,
Florian
More information about the Libc-alpha
mailing list