BUG/MINOR: mworker: avoid passing NULL version in proc list serialization

Add a NULL guard for the version field. This has no functional impact
since the master process never uses this field for its own mworker_proc
element, and should be the only one impacted. This avoid seeing "(null)"
in the version field when debugging.

Must be backported to 3.1 and later.
This commit is contained in:
William Lallemand 2026-03-13 20:24:37 +01:00
parent 51d6f1ca4f
commit a3bf0de651

View File

@ -125,7 +125,7 @@ void mworker_proc_list_to_env()
type = 'w';
if (child->pid > -1)
memprintf(&msg, "%s|type=%c;fd=%d;cfd=%d;pid=%d;reloads=%d;failedreloads=%d;timestamp=%d;id=%s;version=%s", msg ? msg : "", type, child->ipc_fd[0], child->ipc_fd[1], child->pid, child->reloads, child->failedreloads, child->timestamp, child->id ? child->id : "", child->version);
memprintf(&msg, "%s|type=%c;fd=%d;cfd=%d;pid=%d;reloads=%d;failedreloads=%d;timestamp=%d;id=%s;version=%s", msg ? msg : "", type, child->ipc_fd[0], child->ipc_fd[1], child->pid, child->reloads, child->failedreloads, child->timestamp, child->id ? child->id : "", child->version ? child->version : "");
}
if (msg)
setenv("HAPROXY_PROCESSES", msg, 1);