From 9bd8a788c8f236243e9abd2a8b975c738ba7572b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 19 Jun 2023 21:19:09 +0800 Subject: [PATCH] Chassis: print version; don't print N/A --- src/detection/chassis/chassis_linux.c | 3 ++- src/modules/chassis/chassis.c | 11 ++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/detection/chassis/chassis_linux.c b/src/detection/chassis/chassis_linux.c index 0e40b217e..66e30e447 100644 --- a/src/detection/chassis/chassis_linux.c +++ b/src/detection/chassis/chassis_linux.c @@ -23,7 +23,8 @@ static bool hostValueSet(FFstrbuf* value) ffStrbufIgnCaseCompS(value, "Not Applicable") != 0 && ffStrbufIgnCaseCompS(value, "INVALID") != 0 && ffStrbufIgnCaseCompS(value, "Type1ProductConfigId") != 0 && - ffStrbufIgnCaseCompS(value, "All Series") != 0 + ffStrbufIgnCaseCompS(value, "All Series") != 0 && + ffStrbufIgnCaseCompS(value, "N/A") != 0 ; } diff --git a/src/modules/chassis/chassis.c b/src/modules/chassis/chassis.c index da6b6cf94..66ae7f2d7 100644 --- a/src/modules/chassis/chassis.c +++ b/src/modules/chassis/chassis.c @@ -30,13 +30,10 @@ void ffPrintChassis(FFinstance* instance, FFChassisOptions* options) if(options->moduleArgs.outputFormat.length == 0) { ffPrintLogoAndKey(instance, FF_CHASSIS_MODULE_NAME, 0, &options->moduleArgs.key, &options->moduleArgs.keyColor); - - FF_STRBUF_AUTO_DESTROY output = ffStrbufCreateCopy(&result.chassisType); - - if(result.chassisVersion.length > 0) - ffStrbufAppendF(&output, " (%s)", result.chassisVersion.chars); - - ffStrbufPutTo(&output, stdout); + ffStrbufWriteTo(&result.chassisType, stdout); + if (result.chassisVersion.length) + printf(" (%s)", result.chassisVersion.chars); + putchar('\n'); } else {