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 /include | |
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 'include')
-rw-r--r-- | include/libbb.h | 3 | ||||
-rw-r--r-- | include/mingw.h | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/include/libbb.h b/include/libbb.h index 3d6a6a0cf..a7f32e21e 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -202,6 +202,9 @@ int klogctl(int type, char *b, int len); | |||
202 | 202 | ||
203 | #if ENABLE_PLATFORM_MINGW32 | 203 | #if ENABLE_PLATFORM_MINGW32 |
204 | # include "mingw.h" | 204 | # include "mingw.h" |
205 | # define MINGW_SPECIAL(a) mingw_ ## a | ||
206 | #else | ||
207 | # define MINGW_SPECIAL(a) a | ||
205 | #endif | 208 | #endif |
206 | 209 | ||
207 | /* Busybox does not use threads, we can speed up stdio. */ | 210 | /* Busybox does not use threads, we can speed up stdio. */ |
diff --git a/include/mingw.h b/include/mingw.h index d1e638231..a1ba5f5af 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
@@ -429,7 +429,11 @@ enum {DEV_NULL, DEV_ZERO, DEV_URANDOM, NOT_DEVICE = -1}; | |||
429 | int get_dev_type(const char *filename); | 429 | int get_dev_type(const char *filename); |
430 | void update_dev_fd(int dev, int fd); | 430 | void update_dev_fd(int dev, int fd); |
431 | int mingw_open (const char *filename, int oflags, ...); | 431 | int mingw_open (const char *filename, int oflags, ...); |
432 | |||
433 | /* functions which add O_SPECIAL to open(2) to allow access to devices */ | ||
432 | int mingw_xopen(const char *filename, int oflags); | 434 | int mingw_xopen(const char *filename, int oflags); |
435 | ssize_t mingw_open_read_close(const char *fn, void *buf, size_t size) FAST_FUNC; | ||
436 | |||
433 | ssize_t mingw_read(int fd, void *buf, size_t count); | 437 | ssize_t mingw_read(int fd, void *buf, size_t count); |
434 | int mingw_close(int fd); | 438 | int mingw_close(int fd); |
435 | int pipe(int filedes[2]); | 439 | int pipe(int filedes[2]); |