Skip to content

libc: picolibc: fputc should return the value it has written #74629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions lib/libc/picolibc/stdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ static LIBC_DATA int (*_stdout_hook)(int);

int z_impl_zephyr_fputc(int a, FILE *out)
{
(*_stdout_hook)(a);
return 0;
return ((out == stdout) || (out == stderr)) ? (*_stdout_hook)(a) : EOF;
}

#ifdef CONFIG_USERSPACE
Expand All @@ -24,8 +23,7 @@ static inline int z_vrfy_zephyr_fputc(int c, FILE *stream)

static int picolibc_put(char a, FILE *f)
{
zephyr_fputc(a, f);
return 0;
return zephyr_fputc(a, f);
}

static LIBC_DATA FILE __stdout = FDEV_SETUP_STREAM(picolibc_put, NULL, NULL, 0);
Expand Down