From 3bb95a59457430e0d91ba5e493603e55bc174fb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20M=C3=BChlstrasser?= Date: Sun, 19 May 2024 01:37:57 +0200 Subject: [PATCH] stdout was no longer line-buffered Fixed the problem that stdout was no longer line-buffered. Fixes #35. --- libs/circle-newlib | 2 +- samples/05-smoketest/kernel.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/libs/circle-newlib b/libs/circle-newlib index 584d4c2..abbc9da 160000 --- a/libs/circle-newlib +++ b/libs/circle-newlib @@ -1 +1 @@ -Subproject commit 584d4c22e18665d204f4e4169ea29f8e86f6e2ad +Subproject commit abbc9da973ba43628eddecf525a75df9a1173a27 diff --git a/samples/05-smoketest/kernel.cpp b/samples/05-smoketest/kernel.cpp index ac35aad..9553679 100644 --- a/samples/05-smoketest/kernel.cpp +++ b/samples/05-smoketest/kernel.cpp @@ -577,6 +577,18 @@ CKernel::IoTest (void) Report ("fork() is not implemented, fails as expected"); } + // Check fix for issue #35. + Report ("File descriptors 0, 1, 2 are character special files"); + + for (int fd = 0; fd < 3; fd += 1) + { + struct stat statbuf; + if (fstat(fd, &statbuf) == -1 || !S_ISCHR(statbuf.st_mode)) + { + PErrorExit ("Check for S_ISCHR() on stdin/stdout/stderr failed"); + } + }; + Report ("Redirect stdout"); FILE * const redirected_stdout = freopen ("redirected_stdout.txt", "w", stdout);