summaryrefslogtreecommitdiff
path: root/nuttx/lib/stdio/lib_syslogstream.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/lib/stdio/lib_syslogstream.c')
-rw-r--r--nuttx/lib/stdio/lib_syslogstream.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/nuttx/lib/stdio/lib_syslogstream.c b/nuttx/lib/stdio/lib_syslogstream.c
index 20c6165ca..1a47f6abb 100644
--- a/nuttx/lib/stdio/lib_syslogstream.c
+++ b/nuttx/lib/stdio/lib_syslogstream.c
@@ -40,6 +40,7 @@
#include <nuttx/config.h>
#include <unistd.h>
+#include <assert.h>
#include <errno.h>
#include <nuttx/syslog.h>
@@ -62,10 +63,31 @@
static void syslogstream_putc(FAR struct lib_outstream_s *this, int ch)
{
- /* Write the character to the supported logging device */
-
- (void)syslog_putc(ch);
- this->nput++;
+ int ret;
+
+ /* Try writing until the write was successful or until an irrecoverable
+ * error occurs.
+ */
+
+ for (;;)
+ {
+ /* Write the character to the supported logging device */
+
+ ret = syslog_putc(ch);
+ if (ret == OK)
+ {
+ this->nput++;
+ return;
+ }
+
+ /* On failure syslog_putc will return a negated errno value. The
+ * errno variable will not be set. The special value -EINTR means that
+ * syslog_putc() was awakened by a signal. This is not a real error and
+ * must be ignored in this context.
+ */
+
+ DEBUGASSERT(ret == -EINTR);
+ }
}
/****************************************************************************