aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Hunter <ext-adrian.hunter@nokia.com>2007-03-16 18:07:43 +0200
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-03-29 17:15:55 +0300
commit2271f47026e986ecd038db8fbf7a1d14c11a7b64 (patch)
tree51dd7ce37629b1fdb44945f95735ec33fbac4d4a
parent55d6da34828c784b7f3f9ffddb4a6dd5bdf65d46 (diff)
UBI-Utils: Updated libubi for latest UBI
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
-rw-r--r--ubi-utils/src/libubi.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/ubi-utils/src/libubi.c b/ubi-utils/src/libubi.c
index 62216ad..da4919b 100644
--- a/ubi-utils/src/libubi.c
+++ b/ubi-utils/src/libubi.c
@@ -311,7 +311,7 @@ ubi_open(ubi_lib_t *desc)
if (err)
goto error;
- res->vdev_path = mkpath(res->udev_path, "%d/");
+ res->vdev_path = mkpath(res->ubi_root, "ubi%d_%d/");
if (!res->vdev_path)
goto error;
@@ -595,6 +595,11 @@ ubi_mkvol(ubi_lib_t desc, int devn, int vol_id, int vol_type,
int fd;
int err;
struct ubi_mkvol_req req;
+ size_t n;
+
+ n = strlen(name);
+ if (n > UBI_MAX_VOLUME_NAME)
+ return -1;
if ((fd = ubi_cdev_open(desc, devn, O_RDWR)) == -1)
return -1;
@@ -603,8 +608,9 @@ ubi_mkvol(ubi_lib_t desc, int devn, int vol_id, int vol_type,
req.bytes = bytes;
req.vol_type = vol_type;
req.alignment = alignment;
- req.name_len = strlen(name);
- req.name = name;
+
+ strncpy(req.name, name, UBI_MAX_VOLUME_NAME + 1);
+ req.name_len = n;
/* printf("DBG: %s(vol_id=%d, bytes=%lld, type=%d, alig=%d, nlen=%d, "
"name=%s)\n", __func__, vol_id, bytes, vol_type, alignment,