aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-09-17 17:57:40 +0100
committerRon Yorston <rmy@pobox.com>2021-09-17 18:05:16 +0100
commit5f652529e4e62e9b98ccded179e773c5ae2fac55 (patch)
tree8109d25d129ef2b84a312caac1074a5d773840e2
parent9428d54ff38e2cbc8d6977fb3ab67edab91fd350 (diff)
downloadbusybox-w32-5f652529e4e62e9b98ccded179e773c5ae2fac55.tar.gz
busybox-w32-5f652529e4e62e9b98ccded179e773c5ae2fac55.tar.bz2
busybox-w32-5f652529e4e62e9b98ccded179e773c5ae2fac55.zip
ash: avoid problems with non-zero DEBUG
When DEBUG had a non-zero value the preprocessor complained that 'close' was being redefined. In a WIN32 build it's set to 'mingw_close'. Since this isn't necessary in ash it can be undefined without ill effects. DEBUG can be set to 1 or 2. In a WIN32 build this value was being used to calculate indices for optlist[], giving incorrect results. Using (DEBUG != 0) instead fixes this.
-rw-r--r--shell/ash.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 8e43acdb0..f91cd7e1f 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -591,12 +591,12 @@ struct globals_misc {
591# define debug optlist[17 + BASH_PIPEFAIL] 591# define debug optlist[17 + BASH_PIPEFAIL]
592#endif 592#endif
593#if ENABLE_PLATFORM_MINGW32 593#if ENABLE_PLATFORM_MINGW32
594# define winxp optlist[16 + BASH_PIPEFAIL + 2*DEBUG] 594# define winxp optlist[16 + BASH_PIPEFAIL + 2*(DEBUG != 0)]
595# if ENABLE_ASH_NOCONSOLE 595# if ENABLE_ASH_NOCONSOLE
596# define noconsole optlist[17 + BASH_PIPEFAIL + 2*DEBUG] 596# define noconsole optlist[17 + BASH_PIPEFAIL + 2*(DEBUG != 0)]
597# endif 597# endif
598# if ENABLE_ASH_NOCASEGLOB 598# if ENABLE_ASH_NOCASEGLOB
599# define nocaseglob optlist[17 + BASH_PIPEFAIL + 2*DEBUG+ENABLE_ASH_NOCONSOLE] 599# define nocaseglob optlist[17 + BASH_PIPEFAIL + 2*(DEBUG != 0) + ENABLE_ASH_NOCONSOLE]
600# endif 600# endif
601#endif 601#endif
602 602
@@ -698,6 +698,9 @@ static void trace_printf(const char *fmt, ...);
698static void trace_vprintf(const char *fmt, va_list va); 698static void trace_vprintf(const char *fmt, va_list va);
699# define TRACE(param) trace_printf param 699# define TRACE(param) trace_printf param
700# define TRACEV(param) trace_vprintf param 700# define TRACEV(param) trace_vprintf param
701# if ENABLE_PLATFORM_MINGW32 && defined(close)
702# undef close
703# endif
701# define close(fd) do { \ 704# define close(fd) do { \
702 int dfd = (fd); \ 705 int dfd = (fd); \
703 if (close(dfd) < 0) \ 706 if (close(dfd) < 0) \