summaryrefslogtreecommitdiff
path: root/ubi-utils/src/ubiattach.c
diff options
context:
space:
mode:
Diffstat (limited to 'ubi-utils/src/ubiattach.c')
-rw-r--r--ubi-utils/src/ubiattach.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ubi-utils/src/ubiattach.c b/ubi-utils/src/ubiattach.c
index 1f72620..a935b42 100644
--- a/ubi-utils/src/ubiattach.c
+++ b/ubi-utils/src/ubiattach.c
@@ -153,9 +153,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.