code that would crash ESP32
This commit is contained in:
parent
e9284e1914
commit
0dda33c754
1 changed files with 3 additions and 1 deletions
4
log.cpp
4
log.cpp
|
@ -60,11 +60,11 @@ void dolog(const log_level_t ll, const char *fmt, ...)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!lfh) {
|
if (!lfh) {
|
||||||
|
#if !defined(ESP32)
|
||||||
lfh = fopen(logfile, "a+");
|
lfh = fopen(logfile, "a+");
|
||||||
if (!lfh)
|
if (!lfh)
|
||||||
error_exit(true, "Cannot access log-file %s", logfile);
|
error_exit(true, "Cannot access log-file %s", logfile);
|
||||||
|
|
||||||
#if !defined(ESP32)
|
|
||||||
if (lf_uid != -1 && fchown(fileno(lfh), lf_uid, lf_gid) == -1)
|
if (lf_uid != -1 && fchown(fileno(lfh), lf_uid, lf_gid) == -1)
|
||||||
error_exit(true, "Cannot change logfile (%s) ownership", logfile);
|
error_exit(true, "Cannot change logfile (%s) ownership", logfile);
|
||||||
|
|
||||||
|
@ -95,8 +95,10 @@ void dolog(const log_level_t ll, const char *fmt, ...)
|
||||||
(void)vasprintf(&str, fmt, ap);
|
(void)vasprintf(&str, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
|
#if !defined(ESP32)
|
||||||
if (ll >= log_level_file)
|
if (ll >= log_level_file)
|
||||||
fprintf(lfh, "%s%s\n", ts_str, str);
|
fprintf(lfh, "%s%s\n", ts_str, str);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ll >= log_level_screen)
|
if (ll >= log_level_screen)
|
||||||
printf("%s%s\r\n", ts_str, str);
|
printf("%s%s\r\n", ts_str, str);
|
||||||
|
|
Loading…
Add table
Reference in a new issue