On Thu, 16 Oct 2025 at 07:09, Jean Thomas <[email protected]> wrote:
>
> Lwazi, did you do anything else to get it to use 0-terminated string?
>
> Jean
>
In streams.h, I add 1 to the buffer size:
struct lib_syslograwstream_s
{
struct lib_outstream_s common;
#ifdef CONFIG_SYSLOG_BUFFER
char buffer[CONFIG_SYSLOG_BUFSIZE + 1]; <----
off_t offset;
#endif
int last_ch;
};
And then 0-terminate just before the smh_call(SEMI_SYSLOG_WRITE0..) in
up_nputs.
The 0-termination needs be moved to syslograwstream_flush but I have not
tested this:
static int syslograwstream_flush(FAR struct lib_outstream_s *self)
{
<--snip-->
stream->buffer[stream->offset] = 0;
ssize_t nbytes = syslog_write(stream->buffer, stream->offset);