lib_syslograwstream: fix bug when iob alloc failed
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
This commit is contained in:
parent
7117d3ea8a
commit
8515294caa
@ -255,10 +255,10 @@ struct lib_syslograwstream_s
|
||||
# else
|
||||
char buffer[CONFIG_SYSLOG_BUFSIZE];
|
||||
# endif
|
||||
#endif
|
||||
FAR char *base;
|
||||
int size;
|
||||
int offset;
|
||||
#endif
|
||||
int last_ch;
|
||||
};
|
||||
|
||||
|
@ -288,14 +288,19 @@ void lib_syslograwstream_open(FAR struct lib_syslograwstream_s *stream)
|
||||
stream->base = (FAR void *)stream->iob->io_data;
|
||||
stream->size = sizeof(stream->iob->io_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
stream->base = NULL;
|
||||
stream->size = 0;
|
||||
}
|
||||
# else
|
||||
stream->base = stream->buffer;
|
||||
stream->size = sizeof(stream->buffer);
|
||||
# endif
|
||||
stream->offset = 0;
|
||||
#else
|
||||
stream->public.flush = lib_noflush;
|
||||
#endif
|
||||
stream->offset = 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user