aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--miscutils/ubi_tools.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/miscutils/ubi_tools.c b/miscutils/ubi_tools.c
index 33059873a..d923f1c5a 100644
--- a/miscutils/ubi_tools.c
+++ b/miscutils/ubi_tools.c
@@ -92,6 +92,13 @@ static unsigned get_num_from_file(const char *path, unsigned max, const char *er
92int ubi_tools_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 92int ubi_tools_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
93int ubi_tools_main(int argc UNUSED_PARAM, char **argv) 93int ubi_tools_main(int argc UNUSED_PARAM, char **argv)
94{ 94{
95 static const struct suffix_mult size_suffixes[] = {
96 { "KiB", 1024 },
97 { "MiB", 1024*1024 },
98 { "GiB", 1024*1024*1024 },
99 { "", 0 }
100 };
101
95 unsigned opts; 102 unsigned opts;
96 char *ubi_ctrl; 103 char *ubi_ctrl;
97 int fd; 104 int fd;
@@ -140,7 +147,7 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv)
140#define OPTION_t (1 << 6) 147#define OPTION_t (1 << 6)
141 148
142 if (opts & OPTION_s) 149 if (opts & OPTION_s)
143 size_bytes = xatoull(size_bytes_str); 150 size_bytes = xatoull_sfx(size_bytes_str, size_suffixes);
144 argv += optind; 151 argv += optind;
145 ubi_ctrl = *argv++; 152 ubi_ctrl = *argv++;
146 153