You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/07/09 02:13:43 UTC

[incubator-nuttx] branch master updated: drivers/syslog: Avoid prepending process name when no TCB is available

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new d12619c  drivers/syslog: Avoid prepending process name when no TCB is available
d12619c is described below

commit d12619c85fd9494bf60d5f77b2734e9b4625c8da
Author: Gustavo Henrique Nihei <gu...@espressif.com>
AuthorDate: Thu Jul 8 13:57:57 2021 -0300

    drivers/syslog: Avoid prepending process name when no TCB is available
    
    Signed-off-by: Gustavo Henrique Nihei <gu...@espressif.com>
---
 drivers/syslog/vsyslog.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/syslog/vsyslog.c b/drivers/syslog/vsyslog.c
index f486dec..5592995 100644
--- a/drivers/syslog/vsyslog.c
+++ b/drivers/syslog/vsyslog.c
@@ -206,7 +206,8 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap)
   /* Prepend the process name */
 
   tcb = nxsched_get_tcb(getpid());
-  ret += lib_sprintf(&stream.public, "%s: ", tcb->name);
+  ret += lib_sprintf(&stream.public, "%s: ",
+                     (tcb != NULL) ? tcb->name : "(null)");
 #endif
 
   /* Generate the output */