From 510c2ddc147649811d39c6ba3758b768cfab7b6d Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 15 Jan 2015 11:51:52 +0100 Subject: [PATCH] system: improve system name detection Skip entries like "Processor: 0" which are common on x86, otherwise an "ubus call system board" will just return "system: 0". Signed-off-by: Jo-Philipp Wich --- system.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/system.c b/system.c index 4b3b82c..1e88b5d 100644 --- a/system.c +++ b/system.c @@ -20,6 +20,7 @@ #include #include #include +#include #include @@ -64,8 +65,13 @@ static int system_board(struct ubus_context *ctx, struct ubus_object *obj, !strcasecmp(key, "processor") || !strcasecmp(key, "model name")) { - blobmsg_add_string(&b, "system", val + 2); - break; + strtoul(val + 2, &key, 0); + + if (key == (val + 2) || *key != 0) + { + blobmsg_add_string(&b, "system", val + 2); + break; + } } } -- 2.25.1