aboutsummaryrefslogtreecommitdiff
path: root/coreutils/shred.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-01-25 13:57:08 +0000
committerRon Yorston <rmy@pobox.com>2021-01-25 14:15:02 +0000
commiteb0c2bbbaf0722103124a589e3dfe952c2664cbb (patch)
tree3ae3ec89bd7a6041ed5aed1d537f6b2fb3586ed7 /coreutils/shred.c
parent6422b0ef38d0835c86b40e6e642f18cdfb933e85 (diff)
downloadbusybox-w32-eb0c2bbbaf0722103124a589e3dfe952c2664cbb.tar.gz
busybox-w32-eb0c2bbbaf0722103124a589e3dfe952c2664cbb.tar.bz2
busybox-w32-eb0c2bbbaf0722103124a589e3dfe952c2664cbb.zip
tls: avoid unnecessary changes to POSIX build, part 2
On reflection, the previous commit may have been ill-advised. There are many calls to open_read_close() and most shouldn't be able to access special devices. (Though in practice only a few are enabled in busybox-w32.) Nonetheless, I've implemented a new mechanism which uses the macro MINGW_SPECIAL() to mark calls to functions that are allowed to access special devices. An unrelated change is to avoid compiling fputs_stdout() in coreutils/printf.c for the POSIX build.
Diffstat (limited to 'coreutils/shred.c')
-rw-r--r--coreutils/shred.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/coreutils/shred.c b/coreutils/shred.c
index 86d4b66b4..0b11b9491 100644
--- a/coreutils/shred.c
+++ b/coreutils/shred.c
@@ -38,10 +38,6 @@
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
45int shred_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 41int shred_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
46int shred_main(int argc UNUSED_PARAM, char **argv) 42int shred_main(int argc UNUSED_PARAM, char **argv)
47{ 43{
@@ -61,9 +57,9 @@ int shred_main(int argc UNUSED_PARAM, char **argv)
61 opt = getopt32(argv, "fuzn:+vx", &num_iter); 57 opt = getopt32(argv, "fuzn:+vx", &num_iter);
62 argv += optind; 58 argv += optind;
63 59
64 zero_fd = xopen("/dev/zero", O_RDONLY); 60 zero_fd = MINGW_SPECIAL(xopen)("/dev/zero", O_RDONLY);
65 if (num_iter != 0) 61 if (num_iter != 0)
66 rand_fd = xopen("/dev/urandom", O_RDONLY); 62 rand_fd = MINGW_SPECIAL(xopen)("/dev/urandom", O_RDONLY);
67 63
68 if (!*argv) 64 if (!*argv)
69 bb_show_usage(); 65 bb_show_usage();