Commit Graph

6 Commits

Author SHA1 Message Date
Leonardo Grasso
abdf5512c8 fix(userspace): add portable compat wrappers for gmtime_r, localtime_r, strerror_r
The previous commits used gmtime_r/localtime_r (unavailable on Windows)
and assumed the GNU strerror_r variant returning char* (only on glibc).
This broke macOS, musl, WASM, and Win32 builds.

Add userspace/engine/compat.h with portable inline wrappers:
- falco_gmtime_r / falco_localtime_r: use gmtime_s/localtime_s on Win32
- falco_strerror_r: returns const char* on all platforms, detecting
  glibc via __GLIBC__ (not _GNU_SOURCE alone, since musl defines
  _GNU_SOURCE but provides the XSI variant returning int)

Also fixes a pre-existing bug in create_signal_handlers.cpp where
the GNU strerror_r return value was incorrectly compared to 0 and
the actual error string was discarded.

Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2026-04-09 16:57:04 +02:00
Leonardo Grasso
5e91db569a fix(userspace): replace gmtime/localtime with reentrant variants
gmtime() and localtime() return pointers to a shared static buffer,
making them unsafe in multi-threaded contexts. Replace all call sites
with gmtime_r() and localtime_r() which use caller-provided buffers.

Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2026-04-09 16:56:43 +02:00
Leonardo Di Giovanna
4fa53452c3 fix(userspace/engine): fix logger date format
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
2025-09-18 14:54:46 +02:00
Samuel Gaist
e5654849d4 refactor(userspace/engine): port from asctime to strftime
Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
2025-09-16 09:38:29 +02:00
Poiana
50b98b30e5 chore(falco): apply code formatting
Signed-off-by: Poiana <poiana.bot@gmail.com>
2024-09-30 13:25:31 +02:00
Jason Dellaluce
cd1c5f911c refactor(userspace): move falco logger under falco engine
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2024-05-23 09:29:23 +02:00