aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ubifs-utils/libubifs/super.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ubifs-utils/libubifs/super.c b/ubifs-utils/libubifs/super.c
index 1cbbfca..9fa366f 100644
--- a/ubifs-utils/libubifs/super.c
+++ b/ubifs-utils/libubifs/super.c
@@ -43,9 +43,14 @@ int open_ubi(struct ubifs_info *c, const char *node)
{
struct stat st;
- if (stat(node, &st) || !S_ISCHR(st.st_mode))
+ if (stat(node, &st))
return -1;
+ if (!S_ISCHR(st.st_mode)) {
+ errno = ENODEV;
+ return -1;
+ }
+
c->libubi = libubi_open();
if (!c->libubi)
return -1;