diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2009-04-22 14:32:08 +0300 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2009-04-22 17:27:54 +0300 |
commit | e4d974bb63355d1fff92eaae4df5f0cdf3597dc3 (patch) | |
tree | bfba4f78f412a479e14cada6908140173d1f8a91 /ubi-utils/src/ubidetach.c | |
parent | 3ec498778b26134f82bca32c0dc0a71befc48f29 (diff) |
libubi: improve libubi_open interface
Remove the not very nice @required parameter, and add a
possibility to distinguish between real errors and
a situation when UBI is not present.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils/src/ubidetach.c')
-rw-r--r-- | ubi-utils/src/ubidetach.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ubi-utils/src/ubidetach.c b/ubi-utils/src/ubidetach.c index 50670d0..83584cd 100644 --- a/ubi-utils/src/ubidetach.c +++ b/ubi-utils/src/ubidetach.c @@ -139,9 +139,12 @@ int main(int argc, char * const argv[]) if (err) return -1; - libubi = libubi_open(1); - if (libubi == NULL) + libubi = libubi_open(); + if (!libubi) { + if (errno == 0) + return errmsg("UBI is not present in the system"); return sys_errmsg("cannot open libubi"); + } /* * Make sure the kernel is fresh enough and this feature is supported. |