diff options
author | Ron Yorston <rmy@pobox.com> | 2021-01-25 13:57:08 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-01-25 14:15:02 +0000 |
commit | eb0c2bbbaf0722103124a589e3dfe952c2664cbb (patch) | |
tree | 3ae3ec89bd7a6041ed5aed1d537f6b2fb3586ed7 /libbb | |
parent | 6422b0ef38d0835c86b40e6e642f18cdfb933e85 (diff) | |
download | busybox-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 'libbb')
-rw-r--r-- | libbb/read.c | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/libbb/read.c b/libbb/read.c index 2e4317cd5..a342506a8 100644 --- a/libbb/read.c +++ b/libbb/read.c | |||
@@ -73,14 +73,7 @@ ssize_t FAST_FUNC read_close(int fd, void *buf, size_t size) | |||
73 | 73 | ||
74 | ssize_t FAST_FUNC open_read_close(const char *filename, void *buf, size_t size) | 74 | ssize_t FAST_FUNC open_read_close(const char *filename, void *buf, size_t size) |
75 | { | 75 | { |
76 | #if !ENABLE_PLATFORM_MINGW32 | ||
77 | int fd = open(filename, O_RDONLY); | 76 | int fd = open(filename, O_RDONLY); |
78 | #else | ||
79 | int fd, flag; | ||
80 | |||
81 | flag = O_RDONLY | (get_dev_type(filename) == DEV_URANDOM ? O_SPECIAL : 0); | ||
82 | fd = mingw_open(filename, flag); | ||
83 | #endif | ||
84 | if (fd < 0) | 77 | if (fd < 0) |
85 | return fd; | 78 | return fd; |
86 | return read_close(fd, buf, size); | 79 | return read_close(fd, buf, size); |