diff options
author | Ron Yorston <rmy@pobox.com> | 2018-03-15 09:01:45 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2018-03-15 09:01:45 +0000 |
commit | 94cf1f830d25409ba80b0933075e026e41fe0e3c (patch) | |
tree | f3a386872c52bb7c18283a4bca01dade3811d503 /coreutils | |
parent | 6fe4ad9a6c96624c2b75c0d51b035bc1a71d9eba (diff) | |
download | busybox-w32-94cf1f830d25409ba80b0933075e026e41fe0e3c.tar.gz busybox-w32-94cf1f830d25409ba80b0933075e026e41fe0e3c.tar.bz2 busybox-w32-94cf1f830d25409ba80b0933075e026e41fe0e3c.zip |
win32: restrict visibility of special devices
Handling of the special devices /dev/zero and /dev/urandom was
inconsistent:
- they could be used as arguments to 'cat' but not 'od';
- they could not be used in shell redirection.
Restrict the use of these devices to two places:
- as input files to 'dd' with the 'if=' argument;
- internally within 'shred'.
See GitHub issue #98.
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/dd.c | 4 | ||||
-rw-r--r-- | coreutils/shred.c | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/coreutils/dd.c b/coreutils/dd.c index 4362ae798..10066575e 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c | |||
@@ -429,8 +429,10 @@ int dd_main(int argc UNUSED_PARAM, char **argv) | |||
429 | #endif | 429 | #endif |
430 | 430 | ||
431 | if (infile) { | 431 | if (infile) { |
432 | #if !ENABLE_PLATFORM_MINGW32 | ||
432 | xmove_fd(xopen(infile, O_RDONLY), ifd); | 433 | xmove_fd(xopen(infile, O_RDONLY), ifd); |
433 | #if ENABLE_PLATFORM_MINGW32 | 434 | #else |
435 | xmove_fd(mingw_xopen(infile, O_RDONLY), ifd); | ||
434 | if (!strcmp(infile, "/dev/zero")) { | 436 | if (!strcmp(infile, "/dev/zero")) { |
435 | mingw_read_zero(ifd); | 437 | mingw_read_zero(ifd); |
436 | } | 438 | } |
diff --git a/coreutils/shred.c b/coreutils/shred.c index 1b65a359e..0ebbc39ca 100644 --- a/coreutils/shred.c +++ b/coreutils/shred.c | |||
@@ -38,6 +38,10 @@ | |||
38 | 38 | ||
39 | #include "libbb.h" | 39 | #include "libbb.h" |
40 | 40 | ||
41 | #if ENABLE_PLATFORM_MINGW32 | ||
42 | #define xopen mingw_xopen | ||
43 | #endif | ||
44 | |||
41 | int shred_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 45 | int shred_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
42 | int shred_main(int argc UNUSED_PARAM, char **argv) | 46 | int shred_main(int argc UNUSED_PARAM, char **argv) |
43 | { | 47 | { |