From 2958ab2eea915808b92204d328ce754f845e7fed Mon Sep 17 00:00:00 2001 From: Tim Duesterhus Date: Sat, 18 Apr 2020 16:02:47 +0200 Subject: [PATCH] MINOR: version: Show uname output in display_version() This patch adds the sysname, release, version and machine fields from the uname results to the version output. It intentionally leaves out the machine name, because it is usually not useful and users might not want to expose their machine names for privacy reasons. May be backported if it is considered useful for debugging. (cherry picked from commit dfad6a41ad9f012671b703788dd679cf24eb8c5a) Signed-off-by: Willy Tarreau --- src/haproxy.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/haproxy.c b/src/haproxy.c index 6839687..b7cf19e 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -551,6 +552,8 @@ void hap_register_per_thread_free(int (*fct)()) static void display_version() { + struct utsname utsname; + printf("HA-Proxy version %s %s - https://haproxy.org/\n" PRODUCT_STATUS "\n", haproxy_version, haproxy_date); @@ -573,6 +576,10 @@ static void display_version() else printf("Known bugs: " PRODUCT_URL_BUGS "\n", base_version); } + + if (uname(&utsname) == 0) { + printf("Running on: %s %s %s %s\n", utsname.sysname, utsname.release, utsname.version, utsname.machine); + } } static void display_build_opts() -- 1.7.10.4