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/dd.c | |
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/dd.c')
-rw-r--r-- | coreutils/dd.c | 4 |
1 files changed, 3 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 | } |