diff options
-rw-r--r-- | include/my_global.h | 5 | ||||
-rw-r--r-- | mysys/my_fopen.c | 2 | ||||
-rw-r--r-- | mysys/stacktrace.c | 2 |
3 files changed, 4 insertions, 5 deletions
diff --git a/include/my_global.h b/include/my_global.h index 0c15478439f..42e3c1ad0c8 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -421,9 +421,8 @@ extern "C" int madvise(void *addr, size_t len, int behav); #define SIGNAL_HANDLER_RESET_ON_DELIVERY #endif -#ifndef STDERR_FILENO -#define STDERR_FILENO fileno(stderr) -#endif +/* don't assume that STDERR_FILENO is 2, mysqld can freopen */ +#undef STDERR_FILENO /* Deprecated workaround for false-positive uninitialized variables diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c index 99a9035c0c2..9131a2549e0 100644 --- a/mysys/my_fopen.c +++ b/mysys/my_fopen.c @@ -143,7 +143,7 @@ static int no_close(void *cookie __attribute__((unused))) /* A hack around a race condition in the implementation of freopen. - The race condition steams from the fact that the current fd of + The race condition stems from the fact that the current fd of the stream is closed before its number is used to duplicate the new file descriptor. This defeats the desired atomicity of the close and duplicate of dup2(). diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index 402520990b6..ae715c04621 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -744,7 +744,7 @@ void my_safe_print_str(const char *val, int len) size_t my_write_stderr(const void *buf, size_t count) { - return (size_t) write(STDERR_FILENO, buf, count); + return (size_t) write(fileno(stderr), buf, count); } |