aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/dd.c20
-rw-r--r--coreutils/od_bloaty.c7
-rw-r--r--coreutils/stat.c1
-rw-r--r--coreutils/test.c15
-rw-r--r--coreutils/yes.c4
5 files changed, 42 insertions, 5 deletions
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 3d1ba2ee6..8c144cfd2 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -294,6 +294,7 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
294#endif 294#endif
295 }; 295 };
296 smallint exitcode = EXIT_FAILURE; 296 smallint exitcode = EXIT_FAILURE;
297 int devzero = 0;
297 int i; 298 int i;
298 size_t ibs = 512; 299 size_t ibs = 512;
299 char *ibuf; 300 char *ibuf;
@@ -420,7 +421,12 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
420#endif 421#endif
421 422
422 if (infile) { 423 if (infile) {
423 xmove_fd(xopen(infile, O_RDONLY), ifd); 424 if (ENABLE_PLATFORM_MINGW32 && !strcmp(infile, "/dev/zero")) {
425 G.flags |= FLAG_NOERROR;
426 devzero = 1;
427 } else {
428 xmove_fd(xopen(infile, O_RDONLY), ifd);
429 }
424 } else { 430 } else {
425 infile = bb_msg_standard_input; 431 infile = bb_msg_standard_input;
426 } 432 }
@@ -447,7 +453,7 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
447 } else { 453 } else {
448 outfile = bb_msg_standard_output; 454 outfile = bb_msg_standard_output;
449 } 455 }
450 if (skip) { 456 if (skip && !devzero) {
451 size_t blocksz = (G.flags & FLAG_SKIP_BYTES) ? 1 : ibs; 457 size_t blocksz = (G.flags & FLAG_SKIP_BYTES) ? 1 : ibs;
452 if (lseek(ifd, skip * blocksz, SEEK_CUR) < 0) { 458 if (lseek(ifd, skip * blocksz, SEEK_CUR) < 0) {
453 do { 459 do {
@@ -467,7 +473,12 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
467 while (!(G.flags & FLAG_COUNT) || (G.in_full + G.in_part != count)) { 473 while (!(G.flags & FLAG_COUNT) || (G.in_full + G.in_part != count)) {
468 ssize_t n; 474 ssize_t n;
469 475
470 n = safe_read(ifd, ibuf, ibs); 476 if (devzero) {
477 memset(ibuf, 0, ibs);
478 n = ibs;
479 }
480 else
481 n = safe_read(ifd, ibuf, ibs);
471 if (n == 0) 482 if (n == 0)
472 break; 483 break;
473 if (n < 0) { 484 if (n < 0) {
@@ -543,7 +554,8 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
543 if (write_and_stats(obuf, oc, obs, outfile)) 554 if (write_and_stats(obuf, oc, obs, outfile))
544 goto out_status; 555 goto out_status;
545 } 556 }
546 if (close(ifd) < 0) { 557
558 if (!devzero && close(ifd) < 0) {
547 die_infile: 559 die_infile:
548 bb_simple_perror_msg_and_die(infile); 560 bb_simple_perror_msg_and_die(infile);
549 } 561 }
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c
index f13bdfc11..b02fb09bd 100644
--- a/coreutils/od_bloaty.c
+++ b/coreutils/od_bloaty.c
@@ -101,6 +101,13 @@ typedef long long llong;
101# define LDBL_DIG DBL_DIG 101# define LDBL_DIG DBL_DIG
102#endif 102#endif
103 103
104#if ENABLE_PLATFORM_MINGW32
105/* symbol conflict */
106#define CHAR SIZE_CHAR
107#define SHORT SIZE_SHORT
108#define LONG SIZE_LONG
109#define INT SIZE_INT
110#endif
104enum size_spec { 111enum size_spec {
105 NO_SIZE, 112 NO_SIZE,
106 CHAR, 113 CHAR,
diff --git a/coreutils/stat.c b/coreutils/stat.c
index b918ec62e..109b5258c 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -31,7 +31,6 @@
31//config: bool "Enable display of filesystem status (-f)" 31//config: bool "Enable display of filesystem status (-f)"
32//config: default y 32//config: default y
33//config: depends on STAT 33//config: depends on STAT
34//config: select PLATFORM_LINUX # statfs()
35//config: help 34//config: help
36//config: Without this, stat will not support the '-f' option to display 35//config: Without this, stat will not support the '-f' option to display
37//config: information about filesystem status. 36//config: information about filesystem status.
diff --git a/coreutils/test.c b/coreutils/test.c
index 9e18ee986..df42590e4 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -655,6 +655,21 @@ static int filstat(char *nm, enum token mode)
655 return 0; 655 return 0;
656 } 656 }
657 657
658#if ENABLE_PLATFORM_MINGW32
659 if (mode == FILEX) {
660 char *p;
661
662 if (file_is_executable(nm)) {
663 return 1;
664 }
665 else if ((p=file_is_win32_executable(nm))) {
666 free(p);
667 return 1;
668 }
669 return 0;
670 }
671#endif
672
658 if (stat(nm, &s) != 0) 673 if (stat(nm, &s) != 0)
659 return 0; 674 return 0;
660 if (mode == FILEXIST) 675 if (mode == FILEXIST)
diff --git a/coreutils/yes.c b/coreutils/yes.c
index 81d875589..ce6a90fc0 100644
--- a/coreutils/yes.c
+++ b/coreutils/yes.c
@@ -40,6 +40,10 @@ int yes_main(int argc UNUSED_PARAM, char **argv)
40 ++argv; 40 ++argv;
41 41
42 do { 42 do {
43#if ENABLE_PLATFORM_MINGW32
44 if (ferror(stdout) != 0)
45 break;
46#endif
43 pp = argv; 47 pp = argv;
44 while (1) { 48 while (1) {
45 fputs(*pp, stdout); 49 fputs(*pp, stdout);