aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--miscutils/ubi_tools.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/miscutils/ubi_tools.c b/miscutils/ubi_tools.c
index d9b76b69c..494718ccf 100644
--- a/miscutils/ubi_tools.c
+++ b/miscutils/ubi_tools.c
@@ -298,7 +298,7 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv)
298 } else 298 } else
299 299
300//usage:#define ubiupdatevol_trivial_usage 300//usage:#define ubiupdatevol_trivial_usage
301//usage: "[-t | [-s SIZE] IMG_FILE] UBI_DEVICE" 301//usage: "-t UBI_DEVICE | [-s SIZE] UBI_DEVICE IMG_FILE"
302//usage:#define ubiupdatevol_full_usage "\n\n" 302//usage:#define ubiupdatevol_full_usage "\n\n"
303//usage: "Update UBI volume\n" 303//usage: "Update UBI volume\n"
304//usage: "\n -t Truncate to zero size" 304//usage: "\n -t Truncate to zero size"
@@ -313,7 +313,6 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv)
313 xioctl(fd, UBI_IOCVOLUP, &bytes64); 313 xioctl(fd, UBI_IOCVOLUP, &bytes64);
314 } 314 }
315 else { 315 else {
316 struct stat st;
317 unsigned ubinum, volnum; 316 unsigned ubinum, volnum;
318 unsigned leb_size; 317 unsigned leb_size;
319 ssize_t len; 318 ssize_t len;
@@ -327,12 +326,15 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv)
327 sprintf(path_sys_class_ubi_ubi, "%u_%u/usable_eb_size", ubinum, volnum); 326 sprintf(path_sys_class_ubi_ubi, "%u_%u/usable_eb_size", ubinum, volnum);
328 leb_size = get_num_from_file(path, MAX_SANE_ERASEBLOCK, "Can't get usable eraseblock size from '%s'"); 327 leb_size = get_num_from_file(path, MAX_SANE_ERASEBLOCK, "Can't get usable eraseblock size from '%s'");
329 328
330 if (!(opts & OPTION_s)) { 329 if (!(opts & OPTION_t)) {
331 if (!*argv) 330 if (!*argv)
332 bb_show_usage(); 331 bb_show_usage();
333 xmove_fd(xopen(*argv, O_RDONLY), STDIN_FILENO); 332 xmove_fd(xopen(*argv, O_RDONLY), STDIN_FILENO);
334 xfstat(STDIN_FILENO, &st, *argv); 333 if (!(opts & OPTION_s)) {
335 size_bytes = st.st_size; 334 struct stat st;
335 xfstat(STDIN_FILENO, &st, *argv);
336 size_bytes = st.st_size;
337 }
336 } 338 }
337 339
338 bytes64 = size_bytes; 340 bytes64 = size_bytes;