From 233824d00b526d82dd2ef05d6dad4dbc5b4cc943 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Sun, 23 Dec 2007 14:14:54 +0200 Subject: ubi-utils: be backward-compatible Since control device is not supported by UBI in mainline kernels, we should not panic if it is absent. Signed-off-by: Artem Bityutskiy --- ubi-utils/src/libubi.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'ubi-utils/src/libubi.c') diff --git a/ubi-utils/src/libubi.c b/ubi-utils/src/libubi.c index e754747..9aa7847 100644 --- a/ubi-utils/src/libubi.c +++ b/ubi-utils/src/libubi.c @@ -749,8 +749,15 @@ int ubi_get_info(libubi_t desc, struct ubi_info *info) memset(info, '\0', sizeof(struct ubi_info)); - if (read_major(lib->ctrl_dev, &info->ctrl_major, &info->ctrl_minor)) - return -1; + if (read_major(lib->ctrl_dev, &info->ctrl_major, &info->ctrl_minor)) { + /* + * Older UBI versions did not have control device, so we do not + * panic here for compatibility reasons. May be few years later + * we could return -1 here, but for now just set major:minor to + * -1. + */ + info->ctrl_major = info->ctrl_minor = -1; + } /* * We have to scan the UBI sysfs directory to identify how many UBI -- cgit v1.2.3