ubi tools: ubiupdatevol supports "-" input and actually respects -s SIZE
Decided to not make any flash applets NOEXEC. Minor robustifications here and there. Better error messages. Save on strings: function old new delta ubi_tools_main 1235 1288 +53 ubi_get_volid_by_name 125 133 +8 ubirename_main 198 204 +6 get_num_from_file 90 94 +4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/0 up/down: 71/0) Total: 71 bytes text data bss dec hex filename 915696 485 6880 923061 e15b5 busybox_old 915670 485 6880 923035 e159b busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
//config: Utility to rename UBI volumes
|
||||
|
||||
//applet:IF_UBIRENAME(APPLET(ubirename, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
/* not NOEXEC: if flash operation stalls, use less memory in "hung" process */
|
||||
|
||||
//kbuild:lib-$(CONFIG_UBIRENAME) += ubirename.o
|
||||
|
||||
@@ -80,9 +81,12 @@ int ubirename_main(int argc, char **argv)
|
||||
argv += 2;
|
||||
while (argv[0]) {
|
||||
rnvol->ents[n].vol_id = ubi_get_volid_by_name(ubi_devnum, argv[0]);
|
||||
rnvol->ents[n].name_len = strlen(argv[1]);
|
||||
|
||||
/* strnlen avoids overflow of 16-bit field (paranoia) */
|
||||
rnvol->ents[n].name_len = strnlen(argv[1], sizeof(rnvol->ents[n].name));
|
||||
if (rnvol->ents[n].name_len >= sizeof(rnvol->ents[n].name))
|
||||
bb_error_msg_and_die("new name '%s' is too long", argv[1]);
|
||||
|
||||
strcpy(rnvol->ents[n].name, argv[1]);
|
||||
n++;
|
||||
argv += 2;
|
||||
|
||||
Reference in New Issue
Block a user