MDEV-8540 - Crash on server shutdown since 10.0.16
Only close stdin if it was open initinally. Otherwise we may close file descriptor which is reused for different puprose (specifically for binlog index file in case of this bug).
This commit is contained in:
parent
cc8772f33e
commit
bf4244d1a0
@ -5149,6 +5149,9 @@ int win_main(int argc, char **argv)
|
|||||||
int mysqld_main(int argc, char **argv)
|
int mysqld_main(int argc, char **argv)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
/* We can't close stdin just now, because it may be booststrap mode. */
|
||||||
|
bool please_close_stdin= fcntl(STDIN_FILENO, F_GETFD) >= 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Perform basic thread library and malloc initialization,
|
Perform basic thread library and malloc initialization,
|
||||||
to be able to read defaults files and parse options.
|
to be able to read defaults files and parse options.
|
||||||
@ -5492,7 +5495,9 @@ int mysqld_main(int argc, char **argv)
|
|||||||
(char*) "" : mysqld_unix_port),
|
(char*) "" : mysqld_unix_port),
|
||||||
mysqld_port,
|
mysqld_port,
|
||||||
MYSQL_COMPILATION_COMMENT);
|
MYSQL_COMPILATION_COMMENT);
|
||||||
fclose(stdin);
|
/* Only close stdin if it was open initinally. */
|
||||||
|
if (please_close_stdin)
|
||||||
|
fclose(stdin);
|
||||||
#if defined(_WIN32) && !defined(EMBEDDED_LIBRARY)
|
#if defined(_WIN32) && !defined(EMBEDDED_LIBRARY)
|
||||||
Service.SetRunning();
|
Service.SetRunning();
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user