nuttx/libs/libc/stream
Michal Lenc 1685e8ff7b syslog: avoid an infinite loop if one channel fails
The current implementation exits syslog_write_foreach function
if write to one channel fails, causing other channels not being written
and returning negated errno. libc syslog functions then stay in
an infinite loop, because error is returned and the same bytes
are still passed to syslograwstream_flush and syslog_write_foreach.

The channel write may fail for many reasons - disconnected USB if
CDC ACM syslog is enabled, lost networking if telnet syslog is enabled,
error on NOR flash etc. This shouldn't lead to an ininite loop in the
code though.

The solution ensures all channels in syslog_write_foreach are tried,
therefore the user get the output to the working channels even if
the first one is broken. It also updates syslograwstream_addchar and
syslograwstream_addstring to skip the bytes if all channels fails. This
ensures syslog call won't result in an infinite loop, but the user may
lost the debugging output.

Co-authored-by: Martin Krasula <mkrasula@elektroline.cz>
Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2026-06-23 22:45:01 +08:00
..
CMakeLists.txt libc: Merge lib_vsprintf from lib_libsprintf.c into lib_libvsprintf.c 2025-06-18 09:24:38 +08:00
Kconfig libc/stream: add base64 encoded stream output 2024-10-08 22:33:19 +08:00
lib_base64outstream.c stream: reduce int use, handle FS_LARGEFILE correctly. 2024-11-15 01:05:04 +08:00
lib_blkoutstream.c blk/mtdoutstream: should flush before free 2025-06-17 20:58:13 +08:00
lib_bufferedoutstream.c stream: reduce int use, handle FS_LARGEFILE correctly. 2024-11-15 01:05:04 +08:00
lib_dtoa_data.c libc: Move stream printf/scanf from libc/stdio to libc/stream 2025-06-18 09:24:38 +08:00
lib_dtoa_engine.c libc: Move stream printf/scanf from libc/stdio to libc/stream 2025-06-18 09:24:38 +08:00
lib_dtoa_engine.h libc: Move stream printf/scanf from libc/stdio to libc/stream 2025-06-18 09:24:38 +08:00
lib_fileinstream.c stream: Add fileinstream support 2025-06-17 20:58:13 +08:00
lib_fileoutstream.c libc/stream: Fix the typo error 2025-06-17 20:58:13 +08:00
lib_hexdumpstream.c stream: reduce int use, handle FS_LARGEFILE correctly. 2024-11-15 01:05:04 +08:00
lib_libbsprintf.c !compiler: drop CONFIG_HAVE_LONG_LONG and require long long support 2026-05-19 16:21:28 +08:00
lib_libnoflush.c libs/libc: migrate to SPDX identifier 2024-10-01 12:25:52 +08:00
lib_libsnoflush.c libs/libc: migrate to SPDX identifier 2024-10-01 12:25:52 +08:00
lib_libvscanf.c !libc/stream: remove CONFIG_LIBC_LONG_LONG and always support long long 2026-05-19 16:21:28 +08:00
lib_libvsprintf.c !libc/stream: remove CONFIG_LIBC_LONG_LONG and always support long long 2026-05-19 16:21:28 +08:00
lib_lowoutstream.c libc/stream: Support lowsyslog. 2025-04-02 12:01:46 +08:00
lib_lzfcompress.c fix misspelled names in locally scoped code 2025-05-15 10:12:12 +08:00
lib_meminstream.c stream: reduce int use, handle FS_LARGEFILE correctly. 2024-11-15 01:05:04 +08:00
lib_memoutstream.c stream: reduce int use, handle FS_LARGEFILE correctly. 2024-11-15 01:05:04 +08:00
lib_memsistream.c stream: reduce int use, handle FS_LARGEFILE correctly. 2024-11-15 01:05:04 +08:00
lib_memsostream.c stream: reduce int use, handle FS_LARGEFILE correctly. 2024-11-15 01:05:04 +08:00
lib_mtdoutstream.c blk/mtdoutstream: should flush before free 2025-06-17 20:58:13 +08:00
lib_mtdsostream.c blk/mtdoutstream: should flush before free 2025-06-17 20:58:13 +08:00
lib_nullinstream.c stream: reduce int use, handle FS_LARGEFILE correctly. 2024-11-15 01:05:04 +08:00
lib_nulloutstream.c stream: reduce int use, handle FS_LARGEFILE correctly. 2024-11-15 01:05:04 +08:00
lib_rawinstream.c stream: reduce int use, handle FS_LARGEFILE correctly. 2024-11-15 01:05:04 +08:00
lib_rawoutstream.c stream: reduce int use, handle FS_LARGEFILE correctly. 2024-11-15 01:05:04 +08:00
lib_rawsistream.c stream: reduce int use, handle FS_LARGEFILE correctly. 2024-11-15 01:05:04 +08:00
lib_rawsostream.c stream: reduce int use, handle FS_LARGEFILE correctly. 2024-11-15 01:05:04 +08:00
lib_stdinstream.c stream_getc: use lib_stream_eof instead of EOF 2024-11-26 10:25:36 +08:00
lib_stdoutstream.c stream: reduce int use, handle FS_LARGEFILE correctly. 2024-11-15 01:05:04 +08:00
lib_stdsistream.c stream_getc: use lib_stream_eof instead of EOF 2024-11-26 10:25:36 +08:00
lib_stdsostream.c stream: reduce int use, handle FS_LARGEFILE correctly. 2024-11-15 01:05:04 +08:00
lib_syslograwstream.c syslog: avoid an infinite loop if one channel fails 2026-06-23 22:45:01 +08:00
lib_syslogstream.c stream: reduce int use, handle FS_LARGEFILE correctly. 2024-11-15 01:05:04 +08:00
lib_ultoa_invert.c !libc/stream: remove CONFIG_LIBC_LONG_LONG and always support long long 2026-05-19 16:21:28 +08:00
lib_ultoa_invert.h !libc/stream: remove CONFIG_LIBC_LONG_LONG and always support long long 2026-05-19 16:21:28 +08:00
lib_zeroinstream.c stream: reduce int use, handle FS_LARGEFILE correctly. 2024-11-15 01:05:04 +08:00
Make.defs libc: Merge lib_vsprintf from lib_libsprintf.c into lib_libvsprintf.c 2025-06-18 09:24:38 +08:00