Skip to content

{bp-19884} sched: Fix stdio initialization of standard streams when buffering is disabled - #20073

Merged
xiaoxiang781216 merged 1 commit into
apache:releases/13.0from
jerpelea:bp-19884
Sep 7, 2026
Merged

{bp-19884} sched: Fix stdio initialization of standard streams when buffering is disabled#20073
xiaoxiang781216 merged 1 commit into
apache:releases/13.0from
jerpelea:bp-19884

Conversation

@jerpelea

@jerpelea jerpelea commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Summary

When stdio buffering is disabled, fgetc/getchar on stdin always returned EOF because fs_cookie and fs_oflags were left uninitialized and lib_fread_unlocked bails out on (fs_oflags & O_RDOK) == 0.

Fix this by moving the initialization of the fs_cookie and fs_oflags outside the CONFIG check; these fields need to be initialized regardless of CONFIG_STDIO_DISABLE_BUFFERING.

In addition, initializing stream[i].fs_iofunc pointers to NULL is redundant since the task group is allocated with kmm_zalloc/group_zalloc. Zero allocation was already assumed on fs_flags, so remove the unnecessary code.

Impact

RELEASE

Testing

CI

… disabled

When stdio buffering is disabled, fgetc/getchar on stdin always returned EOF
because fs_cookie and fs_oflags were left uninitialized and lib_fread_unlocked
bails out on (fs_oflags & O_RDOK) == 0.

Fix this by moving the initialization of the fs_cookie and fs_oflags outside the
CONFIG check; these fields need to be initialized regardless of
CONFIG_STDIO_DISABLE_BUFFERING.

In addition, initializing stream[i].fs_iofunc pointers to NULL is redundant
since the task group is allocated with kmm_zalloc/group_zalloc. Zero
allocation was already assumed on fs_flags, so remove the unnecessary code.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
@github-actions github-actions Bot added Area: OS Components OS Components issues Size: XS The size of the change in this PR is very small labels Sep 7, 2026
@jerpelea

jerpelea commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

CI fix
apache/nuttx-apps#3775

@xiaoxiang781216
xiaoxiang781216 merged commit 1563462 into apache:releases/13.0 Sep 7, 2026
22 of 41 checks passed
@jerpelea
jerpelea deleted the bp-19884 branch September 7, 2026 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: OS Components OS Components issues Size: XS The size of the change in this PR is very small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants