From ca31f67c82e2bb7e9f622026980bdf1b3d7162c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 31 Jul 2023 20:29:57 +0800 Subject: [PATCH] Host (Linux): display WSL distro name --- src/detection/host/host_linux.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/detection/host/host_linux.c b/src/detection/host/host_linux.c index 386affbcc..05e48cbbc 100644 --- a/src/detection/host/host_linux.c +++ b/src/detection/host/host_linux.c @@ -50,10 +50,13 @@ const char* ffDetectHost(FFHostResult* host) if(host->productFamily.length == 0 && host->productName.length == 0) { + const char* wslDistroName = getenv("WSL_DISTRO_NAME"); //On WSL, the real host can't be detected. Instead use WSL as host. - if(getenv("WSL_DISTRO") != NULL || getenv("WSL_INTEROP") != NULL) + if(wslDistroName != NULL || getenv("WSL_DISTRO") != NULL || getenv("WSL_INTEROP") != NULL) { ffStrbufAppendS(&host->productName, "Windows Subsystem for Linux"); + if (wslDistroName) + ffStrbufAppendF(&host->productName, " - %s", wslDistroName); ffStrbufAppendS(&host->productFamily, "WSL"); FF_STRBUF_AUTO_DESTROY wslVer = ffStrbufCreate(); //Wide charactors