ubiupdatevol: fix bug with -sSIZE: was ignoring IMAGE_FILE
While at it, fix help text Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
115e0a7199
commit
b34eb4a591
@ -298,7 +298,7 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
} else
|
} else
|
||||||
|
|
||||||
//usage:#define ubiupdatevol_trivial_usage
|
//usage:#define ubiupdatevol_trivial_usage
|
||||||
//usage: "[-t | [-s SIZE] IMG_FILE] UBI_DEVICE"
|
//usage: "-t UBI_DEVICE | [-s SIZE] UBI_DEVICE IMG_FILE"
|
||||||
//usage:#define ubiupdatevol_full_usage "\n\n"
|
//usage:#define ubiupdatevol_full_usage "\n\n"
|
||||||
//usage: "Update UBI volume\n"
|
//usage: "Update UBI volume\n"
|
||||||
//usage: "\n -t Truncate to zero size"
|
//usage: "\n -t Truncate to zero size"
|
||||||
@ -313,7 +313,6 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
xioctl(fd, UBI_IOCVOLUP, &bytes64);
|
xioctl(fd, UBI_IOCVOLUP, &bytes64);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
struct stat st;
|
|
||||||
unsigned ubinum, volnum;
|
unsigned ubinum, volnum;
|
||||||
unsigned leb_size;
|
unsigned leb_size;
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
@ -327,12 +326,15 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
sprintf(path_sys_class_ubi_ubi, "%u_%u/usable_eb_size", ubinum, volnum);
|
sprintf(path_sys_class_ubi_ubi, "%u_%u/usable_eb_size", ubinum, volnum);
|
||||||
leb_size = get_num_from_file(path, MAX_SANE_ERASEBLOCK, "Can't get usable eraseblock size from '%s'");
|
leb_size = get_num_from_file(path, MAX_SANE_ERASEBLOCK, "Can't get usable eraseblock size from '%s'");
|
||||||
|
|
||||||
if (!(opts & OPTION_s)) {
|
if (!(opts & OPTION_t)) {
|
||||||
if (!*argv)
|
if (!*argv)
|
||||||
bb_show_usage();
|
bb_show_usage();
|
||||||
xmove_fd(xopen(*argv, O_RDONLY), STDIN_FILENO);
|
xmove_fd(xopen(*argv, O_RDONLY), STDIN_FILENO);
|
||||||
xfstat(STDIN_FILENO, &st, *argv);
|
if (!(opts & OPTION_s)) {
|
||||||
size_bytes = st.st_size;
|
struct stat st;
|
||||||
|
xfstat(STDIN_FILENO, &st, *argv);
|
||||||
|
size_bytes = st.st_size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes64 = size_bytes;
|
bytes64 = size_bytes;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user