reject invalid routes

This commit is contained in:
2026-06-05 15:13:39 +02:00
parent e76d58d106
commit 85e77c9dc1
5 changed files with 31 additions and 4 deletions

View File

@@ -24,11 +24,16 @@ void Log_Cleanup() {
}
static void log_emit(FILE* stream, const char* level, const char* fmt, va_list ap) {
// Get UNIX millis
struct timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
unsigned long timestamp = ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
char msg[1024];
vsnprintf(msg, sizeof(msg), fmt, ap);
char buf[1024];
int len = snprintf(buf, sizeof(buf), "[%s] %s\n", level, msg);
int len = snprintf(buf, sizeof(buf), "[%lu] [%s] %s\n", timestamp, level, msg);
fputs(buf, stream);
if (log_socket_fd >= 0)
sendto(log_socket_fd, buf, len, 0, (struct sockaddr*)&log_dest, sizeof(log_dest));