diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2015-01-15 11:51:52 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-01-15 12:19:36 +0100 |
commit | 510c2ddc147649811d39c6ba3758b768cfab7b6d (patch) | |
tree | 13a96eeccf43ec4f2e225e879c00933c742ed368 | |
parent | e10fca6b88a8b57fe5a9e80dfd941ae6d98cb970 (diff) | |
download | unitd-510c2ddc147649811d39c6ba3758b768cfab7b6d.tar unitd-510c2ddc147649811d39c6ba3758b768cfab7b6d.zip |
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 <jow@openwrt.org>
-rw-r--r-- | system.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -20,6 +20,7 @@ #include <fcntl.h> #include <signal.h> #include <unistd.h> +#include <stdlib.h> #include <libubox/uloop.h> @@ -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; + } } } |