]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
the logging functions need $(...) for them to be evaluated
authorAlan T. DeKok <aland@freeradius.org>
Thu, 1 Jan 2026 13:48:32 +0000 (08:48 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 1 Jan 2026 13:51:06 +0000 (08:51 -0500)
and for some reason there are CRs added.  So delete those, too

scripts/build/make/log.c

index d839300408d348a22ce7909b419c440e4f5b6509..fa043baa1cfa81a0e17d0745f1f2ca0935c607ff 100644 (file)
@@ -37,7 +37,7 @@ void _make_vlog(char const *log_keyword, char const *file, int line, char const
        va_list ap_q;
        size_t  len;
        char    buffer[256];
-       char    *p = buffer, *end = (p + (sizeof(buffer) - 1));
+       char    *p = buffer, *end = (p + (sizeof(buffer) - 2));
 
        /*
         *      Ensure that there's enough room for the keyword + data.
@@ -45,7 +45,7 @@ void _make_vlog(char const *log_keyword, char const *file, int line, char const
        len = strlen(log_keyword);
        if (len > (sizeof(buffer) / 2)) return;
 
-       memcpy(p, log_keyword, len);
+       snprintf(buffer, sizeof(buffer), "$(%s", log_keyword);
        p += strlen(p);
        *p++ = ' ';
 
@@ -53,7 +53,19 @@ void _make_vlog(char const *log_keyword, char const *file, int line, char const
        vsnprintf(p, end - p, fmt, ap_q);
        va_end(ap_q);
 
-       *end = '\0';    /* Ensure we always \0 terminate */
+       p += strlen(p);
+
+       /*
+        *      For some reason there are trailing CRs added
+        */
+       p--;
+       while (*p < ' ') {
+               *p = '\0';
+               p--;
+       }
+       p++;
+
+       strcpy(p, ")");
 
        gmk_eval(buffer, &(gmk_floc){ .filenm = file, .lineno = line });
 }