strncpy, copy 127 instead of 128 to avoid warning

This commit is contained in:
Paolo 2025-09-22 16:57:15 +02:00
parent 7ee928210a
commit d8aada1d24

View File

@ -110,7 +110,7 @@ static float adjust_param(size_t index, float value) {
static void save_hostname(char dest[128]) { static void save_hostname(char dest[128]) {
dest[0] = 0; dest[0] = 0;
#if defined(__linux__) #if defined(__linux__)
strncpy(dest, program_invocation_name, 128); strncpy(dest, program_invocation_name, 127);
#elif defined(__APPLE__) #elif defined(__APPLE__)
pid_t pid = getpid(); pid_t pid = getpid();
if (proc_name(pid, dest, 128) <= 0) { if (proc_name(pid, dest, 128) <= 0) {