diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2014-09-25 22:10:32 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2014-09-25 22:10:32 +0200 |
commit | 186b98a86f069bb65bf4110e324d75fef98857c0 (patch) | |
tree | 3ef2a680ce89542fa9522fc63c6afe9077bf6233 /miscutils | |
parent | 054f5a5b0d383904e450ca718b1e758ed16baa66 (diff) | |
download | busybox-w32-186b98a86f069bb65bf4110e324d75fef98857c0.tar.gz busybox-w32-186b98a86f069bb65bf4110e324d75fef98857c0.tar.bz2 busybox-w32-186b98a86f069bb65bf4110e324d75fef98857c0.zip |
ubiupdatevol: fix -t to not require an option. Closes 7466
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/ubi_tools.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/miscutils/ubi_tools.c b/miscutils/ubi_tools.c index b71393532..6c09fe534 100644 --- a/miscutils/ubi_tools.c +++ b/miscutils/ubi_tools.c | |||
@@ -125,12 +125,24 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv) | |||
125 | strcpy(path, "/sys/class/ubi/ubi"); | 125 | strcpy(path, "/sys/class/ubi/ubi"); |
126 | memset(&req_structs, 0, sizeof(req_structs)); | 126 | memset(&req_structs, 0, sizeof(req_structs)); |
127 | 127 | ||
128 | #define OPTION_m (1 << 0) | ||
129 | #define OPTION_d (1 << 1) | ||
130 | #define OPTION_n (1 << 2) | ||
131 | #define OPTION_N (1 << 3) | ||
132 | #define OPTION_s (1 << 4) | ||
133 | #define OPTION_a (1 << 5) | ||
134 | #define OPTION_t (1 << 6) | ||
128 | if (do_mkvol) { | 135 | if (do_mkvol) { |
129 | opt_complementary = "-1:d+:n+:a+"; | 136 | opt_complementary = "-1:d+:n+:a+"; |
130 | opts = getopt32(argv, "md:n:N:s:a:t:", | 137 | opts = getopt32(argv, "md:n:N:s:a:t:", |
131 | &dev_num, &vol_id, | 138 | &dev_num, &vol_id, |
132 | &vol_name, &size_bytes_str, &alignment, &type | 139 | &vol_name, &size_bytes_str, &alignment, &type |
133 | ); | 140 | ); |
141 | } else | ||
142 | if (do_update) { | ||
143 | opt_complementary = "-1"; | ||
144 | opts = getopt32(argv, "s:at", &size_bytes_str); | ||
145 | opts *= OPTION_s; | ||
134 | } else { | 146 | } else { |
135 | opt_complementary = "-1:m+:d+:n+:a+"; | 147 | opt_complementary = "-1:m+:d+:n+:a+"; |
136 | opts = getopt32(argv, "m:d:n:N:s:a:t:", | 148 | opts = getopt32(argv, "m:d:n:N:s:a:t:", |
@@ -138,13 +150,6 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv) | |||
138 | &vol_name, &size_bytes_str, &alignment, &type | 150 | &vol_name, &size_bytes_str, &alignment, &type |
139 | ); | 151 | ); |
140 | } | 152 | } |
141 | #define OPTION_m (1 << 0) | ||
142 | #define OPTION_d (1 << 1) | ||
143 | #define OPTION_n (1 << 2) | ||
144 | #define OPTION_N (1 << 3) | ||
145 | #define OPTION_s (1 << 4) | ||
146 | #define OPTION_a (1 << 5) | ||
147 | #define OPTION_t (1 << 6) | ||
148 | 153 | ||
149 | if (opts & OPTION_s) | 154 | if (opts & OPTION_s) |
150 | size_bytes = xatoull_sfx(size_bytes_str, size_suffixes); | 155 | size_bytes = xatoull_sfx(size_bytes_str, size_suffixes); |
@@ -302,9 +307,9 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv) | |||
302 | if (!(opts & OPTION_s)) { | 307 | if (!(opts & OPTION_s)) { |
303 | if (!*argv) | 308 | if (!*argv) |
304 | bb_show_usage(); | 309 | bb_show_usage(); |
305 | xstat(*argv, &st); | ||
306 | size_bytes = st.st_size; | ||
307 | xmove_fd(xopen(*argv, O_RDONLY), STDIN_FILENO); | 310 | xmove_fd(xopen(*argv, O_RDONLY), STDIN_FILENO); |
311 | xfstat(STDIN_FILENO, &st, *argv); | ||
312 | size_bytes = st.st_size; | ||
308 | } | 313 | } |
309 | 314 | ||
310 | bytes64 = size_bytes; | 315 | bytes64 = size_bytes; |