Re: [PATCH v2 08/11] Add stdio_exit_handler()
Sebastian Huber <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
On 17/05/2022 10:36, Takashi Yano wrote:
[...]
> After this commit, "ps | cat" outputs nothing in cygwin. However,
> just "ps" and "ls | cat" works. "stdbuf -o 0 ps | cat" also works.
>
> I am not sure this is the right thing, however, I found the following
> patch solves the issue. It seems that initializing __stdio_exit_handler
> is missing.
>
> diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c
> index 19952d4e0..e759b5402 100644
> --- a/newlib/libc/stdio/findfp.c
> +++ b/newlib/libc/stdio/findfp.c
> @@ -63,6 +63,8 @@ struct _glue __sglue = {NULL, 3, &_GLOBAL_REENT->__sf[0]};
> #endif
> #endif
>
> +static void stdio_exit_handler (void);
> +
> #if (defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED))
> _NOINLINE_STATIC void
> #else
> @@ -109,6 +111,11 @@ std (FILE *ptr,
> if (__stextmode (ptr->_file))
> ptr->_flags |= __SCLE;
> #endif
> +
> + if (__stdio_exit_handler == NULL) {
> + __sinit (_GLOBAL_REENT);
> + __stdio_exit_handler = stdio_exit_handler;
> + }
> }
>
> static inline void
>
> Could you please have a look?
Could you please check if this patch fixes the issue:
https://sourceware.org/pipermail/newlib/2022/019713.html
--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: [email protected]
phone: +49-89-18 94 741 - 16
fax: +49-89-18 94 741 - 08
Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/