[PATCH] lib: framework: report warning[s] correctly (LP:#1223736)

Colin King colin.king at canonical.com
Wed Sep 11 09:08:16 UTC 2013


From: Colin Ian King <colin.king at canonical.com>

Report "warnings" for more than 1 warning, or "warning" for
1 warning. Correcly pluaralise.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/lib/src/fwts_framework.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c
index d44fc22..e2b8805 100644
--- a/src/lib/src/fwts_framework.c
+++ b/src/lib/src/fwts_framework.c
@@ -319,7 +319,9 @@ static void fwts_framework_format_results(char *buffer, int buflen, fwts_results
 		buflen -= n;
 	}
 	if ((include_zero_results || (results->warning > 0)) && (buflen > 0)) {
-		n = snprintf(buffer, buflen, "%s%u warnings", n > 0 ? ", " : "", results->warning);
+		n = snprintf(buffer, buflen, "%s%u warning%s",
+			n > 0 ? ", " : "", results->warning,
+			results->warning > 1 ? "s" : "");
 		buffer += n;
 		buflen -= n;
 	}
-- 
1.8.3.2




More information about the fwts-devel mailing list