mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-12144 Signal 6 crash corrupts ibd files
Avoid using STDERR_FILENO. The server uses freopen(stderr), so stderr can be on any file descriptor.
This commit is contained in:
@@ -421,9 +421,8 @@ extern "C" int madvise(void *addr, size_t len, int behav);
|
|||||||
#define SIGNAL_HANDLER_RESET_ON_DELIVERY
|
#define SIGNAL_HANDLER_RESET_ON_DELIVERY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef STDERR_FILENO
|
/* don't assume that STDERR_FILENO is 2, mysqld can freopen */
|
||||||
#define STDERR_FILENO fileno(stderr)
|
#undef STDERR_FILENO
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Deprecated workaround for false-positive uninitialized variables
|
Deprecated workaround for false-positive uninitialized variables
|
||||||
|
@@ -143,7 +143,7 @@ static int no_close(void *cookie __attribute__((unused)))
|
|||||||
/*
|
/*
|
||||||
A hack around a race condition in the implementation of freopen.
|
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
|
the stream is closed before its number is used to duplicate the
|
||||||
new file descriptor. This defeats the desired atomicity of the
|
new file descriptor. This defeats the desired atomicity of the
|
||||||
close and duplicate of dup2().
|
close and duplicate of dup2().
|
||||||
|
@@ -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)
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user