diff options
author | Davi Arnaut <davi.arnaut@oracle.com> | 2011-01-07 16:33:36 -0200 |
---|---|---|
committer | Davi Arnaut <davi.arnaut@oracle.com> | 2011-01-07 16:33:36 -0200 |
commit | 78b6ca55cbc2ee278c953a00b0e5aa32511253a8 (patch) | |
tree | ba6cafa745b463dda5c02cec1d1fdeacc9953310 /include | |
parent | 5db83bab285ffcd4ec35a4d059ba99460ca1cac7 (diff) | |
download | mariadb-git-78b6ca55cbc2ee278c953a00b0e5aa32511253a8.tar.gz |
Bug#51023: Mysql server crashes on SIGHUP and destroys InnoDB files
From a user perspective, the problem is that a FLUSH LOGS or SIGHUP
signal could end up associating the stdout and stderr to random
files. In the case of this bug report, the streams would end up
associated to InnoDB ibd files.
The freopen(3) function is not thread-safe on FreeBSD. What this
means is that if another thread calls open(2) during freopen()
is executing that another thread's fd returned by open(2) may get
re-associated with the file being passed to freopen(3). See FreeBSD
PR number 79887 for reference:
http://www.freebsd.org/cgi/query-pr.cgi?pr=79887
This problem is worked around by substituting a internal hook within
the FILE structure. This avoids the loss of atomicity by not having
the original fd closed before its duplicated.
Patch based on the original work by Vasil Dimov.
Diffstat (limited to 'include')
-rw-r--r-- | include/my_sys.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/my_sys.h b/include/my_sys.h index 90fd78f77ba..0ac220cec31 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -664,6 +664,7 @@ extern void init_glob_errs(void); extern void wait_for_free_space(const char *filename, int errors); extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags); extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags); +extern FILE *my_freopen(const char *path, const char *mode, FILE *stream); extern int my_fclose(FILE *fd,myf MyFlags); extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags); extern int my_sync(File fd, myf my_flags); |