summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-05-17 22:53:57 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2018-05-21 16:34:10 +0000
commit3a7d7e180a871c5b2b2d98812d9d7f800cf33952 (patch)
treed4bd1765e16d3bf92d360b8c032b86f8a0b3a38f /sql/sql_class.cc
parent2534ae20fd244eed569830bb7159518e42f24baa (diff)
downloadmariadb-git-3a7d7e180a871c5b2b2d98812d9d7f800cf33952.tar.gz
cleanup: create_temp_file()
simplify. move common code inside, specify common flags inside, rewrite dead code (`if (mode & O_TEMPORARY)` on Linux, where `O_TEMPORARY` is always 0) to actually do something.
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc21
1 files changed, 3 insertions, 18 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 92795a8f797..b58ed52db31 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -336,24 +336,9 @@ ulong get_max_connections(void)
extern "C" int mysql_tmpfile(const char *prefix)
{
char filename[FN_REFLEN];
- File fd = create_temp_file(filename, mysql_tmpdir, prefix,
-#ifdef __WIN__
- O_BINARY | O_TRUNC | O_SEQUENTIAL |
- O_SHORT_LIVED |
-#endif /* __WIN__ */
- O_CREAT | O_EXCL | O_RDWR | O_TEMPORARY,
- MYF(MY_WME));
- if (fd >= 0) {
-#ifndef __WIN__
- /*
- This can be removed once the following bug is fixed:
- Bug #28903 create_temp_file() doesn't honor O_TEMPORARY option
- (file not removed) (Unix)
- */
- unlink(filename);
-#endif /* !__WIN__ */
- }
-
+ File fd= create_temp_file(filename, mysql_tmpdir, prefix,
+ O_BINARY | O_SEQUENTIAL,
+ MYF(MY_WME | MY_TEMPORARY));
return fd;
}