aboutsummaryrefslogtreecommitdiff
path: root/coreutils/dd.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/dd.c')
-rw-r--r--coreutils/dd.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/coreutils/dd.c b/coreutils/dd.c
index b5f3cbec5..3054ec6ea 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -91,6 +91,9 @@
91//usage: "\n status=none Suppress all output" 91//usage: "\n status=none Suppress all output"
92//usage: ) 92//usage: )
93//usage: "\n" 93//usage: "\n"
94//usage: IF_PLATFORM_MINGW32(
95//usage: "\nif=/dev/zero and if=/dev/urandom are supported"
96//usage: )
94//usage: "\nN may be suffixed by c (1), w (2), b (512), kB (1000), k (1024), MB, M, GB, G" 97//usage: "\nN may be suffixed by c (1), w (2), b (512), kB (1000), k (1024), MB, M, GB, G"
95//usage: 98//usage:
96//usage:#define dd_example_usage 99//usage:#define dd_example_usage
@@ -367,11 +370,11 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
367#if ENABLE_FEATURE_DD_IBS_OBS 370#if ENABLE_FEATURE_DD_IBS_OBS
368 if (what == OP_ibs) { 371 if (what == OP_ibs) {
369 /* Must fit into positive ssize_t */ 372 /* Must fit into positive ssize_t */
370 ibs = xatoul_range_sfx(val, 1, ((size_t)-1L)/2, cwbkMG_suffixes); 373 ibs = xatoul_range_sfx(val, 1, ULONG_MAX/2, cwbkMG_suffixes);
371 /*continue;*/ 374 /*continue;*/
372 } 375 }
373 if (what == OP_obs) { 376 if (what == OP_obs) {
374 obs = xatoul_range_sfx(val, 1, ((size_t)-1L)/2, cwbkMG_suffixes); 377 obs = xatoul_range_sfx(val, 1, ULONG_MAX/2, cwbkMG_suffixes);
375 /*continue;*/ 378 /*continue;*/
376 } 379 }
377 if (what == OP_conv) { 380 if (what == OP_conv) {
@@ -388,7 +391,7 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
388 } 391 }
389#endif 392#endif
390 if (what == OP_bs) { 393 if (what == OP_bs) {
391 ibs = xatoul_range_sfx(val, 1, ((size_t)-1L)/2, cwbkMG_suffixes); 394 ibs = xatoul_range_sfx(val, 1, ULONG_MAX/2, cwbkMG_suffixes);
392 obs = ibs; 395 obs = ibs;
393 /*continue;*/ 396 /*continue;*/
394 } 397 }
@@ -444,7 +447,12 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
444#endif 447#endif
445 448
446 if (infile) { 449 if (infile) {
450#if !ENABLE_PLATFORM_MINGW32
447 xmove_fd(xopen(infile, O_RDONLY), ifd); 451 xmove_fd(xopen(infile, O_RDONLY), ifd);
452#else
453 xmove_fd(mingw_xopen(infile, O_RDONLY), ifd);
454 update_dev_fd(get_dev_type(infile), ifd);
455#endif
448 } else { 456 } else {
449 infile = bb_msg_standard_input; 457 infile = bb_msg_standard_input;
450 } 458 }
@@ -500,6 +508,7 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
500 508
501 while (!(G.flags & FLAG_COUNT) || (G.in_full + G.in_part != count)) { 509 while (!(G.flags & FLAG_COUNT) || (G.in_full + G.in_part != count)) {
502 ssize_t n; 510 ssize_t n;
511
503#if ENABLE_FEATURE_DD_IBS_OBS 512#if ENABLE_FEATURE_DD_IBS_OBS
504 if (G.flags & FLAG_FULLBLOCK) 513 if (G.flags & FLAG_FULLBLOCK)
505 n = full_read(ifd, ibuf, ibs); 514 n = full_read(ifd, ibuf, ibs);