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 /win32 | |
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 'win32')
-rw-r--r-- | win32/mingw.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/win32/mingw.c b/win32/mingw.c index ed0989be2..474d9cdc6 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -229,6 +229,15 @@ int mingw_xopen(const char *pathname, int flags) | |||
229 | return ret; | 229 | return ret; |
230 | } | 230 | } |
231 | 231 | ||
232 | ssize_t FAST_FUNC mingw_open_read_close(const char *fn, void *buf, size_t size) | ||
233 | { | ||
234 | /* allow use of special devices */ | ||
235 | int fd = mingw_open(fn, O_RDONLY|O_SPECIAL); | ||
236 | if (fd < 0) | ||
237 | return fd; | ||
238 | return read_close(fd, buf, size); | ||
239 | } | ||
240 | |||
232 | #undef fopen | 241 | #undef fopen |
233 | FILE *mingw_fopen (const char *filename, const char *otype) | 242 | FILE *mingw_fopen (const char *filename, const char *otype) |
234 | { | 243 | { |