From 0dda33c754134dad33a2b348dd657e4f958b7fc9 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Fri, 17 Mar 2023 21:17:16 +0100 Subject: [PATCH] code that would crash ESP32 --- log.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/log.cpp b/log.cpp index 0ad9099..f7e65a5 100644 --- a/log.cpp +++ b/log.cpp @@ -60,11 +60,11 @@ void dolog(const log_level_t ll, const char *fmt, ...) return; if (!lfh) { +#if !defined(ESP32) lfh = fopen(logfile, "a+"); if (!lfh) error_exit(true, "Cannot access log-file %s", logfile); -#if !defined(ESP32) if (lf_uid != -1 && fchown(fileno(lfh), lf_uid, lf_gid) == -1) 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); va_end(ap); +#if !defined(ESP32) if (ll >= log_level_file) fprintf(lfh, "%s%s\n", ts_str, str); +#endif if (ll >= log_level_screen) printf("%s%s\r\n", ts_str, str);