You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/07/02 12:25:58 UTC

[GitHub] [incubator-nuttx] Donny9 commented on pull request #4032: syslog: fix crash when print localtime by syslog

Donny9 commented on pull request #4032:
URL: https://github.com/apache/incubator-nuttx/pull/4032#issuecomment-872959309


   > @Donny9 What was the problem with this? I tried it, but I didn't have any kind of "crash", it worked OK for me.
   > 
   > I am following the changes, but I don't understand the functional changes this PR brings. It seems to me only "styling" changes are made. Can you please elaborate on the issue and the solution?
   > 
   > Also, to my understanding this PR introduces a bug.
   > If `OSINIT_HW_READY()` returns false, then the variable `tm` will be used uninitialized in line 132.
   > The same applies for variable `ts` in line 140.
   > 
   > Also, why ingore the return code of the various calls in `clock_gettime()`, `clock_gettime()`, `clock_systime_timespec()`?
   > Isn't it better to check for the error, and provide sane values in `ts` and `tm`?
   
   Hello @fjpanag , you need to enable follow config, then use syslog to output log with localtime in origin code base.
   CONFIG_LIBC_LOCATIME=y
   CONFIG_SYSLOG_TIMESTAMP_FORMATTED=y
   CONFIG_SYSLOG_TIMESTAMP_LOCALTIME=y
   CONFIG_SYSLOG_TIMESTAMP_REALTIME=y
   
   The root cause of cash is that the localtime_r can't be called before OSINIT_HW_READY, because localtime_r will call sem_wait, but semaphore subsystem is uninitialized.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org