Commit c231a228 authored by Marko Mäkelä's avatar Marko Mäkelä

Pull request #660: Simplify os_file_create_tmpfile()

parents 9472f0f4 7bb661cd
...@@ -1109,7 +1109,7 @@ dict_init(void) ...@@ -1109,7 +1109,7 @@ dict_init(void)
dict_operation_lock, SYNC_DICT_OPERATION); dict_operation_lock, SYNC_DICT_OPERATION);
if (!srv_read_only_mode) { if (!srv_read_only_mode) {
dict_foreign_err_file = os_file_create_tmpfile(NULL); dict_foreign_err_file = os_file_create_tmpfile();
ut_a(dict_foreign_err_file); ut_a(dict_foreign_err_file);
} }
......
...@@ -535,14 +535,11 @@ struct os_file_stat_t { ...@@ -535,14 +535,11 @@ struct os_file_stat_t {
}; };
/** Create a temporary file. This function is like tmpfile(3), but /** Create a temporary file. This function is like tmpfile(3), but
the temporary file is created in the given parameter path. If the path the temporary file is created in the in the mysql server configuration
is null then it will create the file in the mysql server configuration
parameter (--tmpdir). parameter (--tmpdir).
@param[in] path location for creating temporary file
@return temporary file handle, or NULL on error */ @return temporary file handle, or NULL on error */
FILE* FILE*
os_file_create_tmpfile( os_file_create_tmpfile();
const char* path);
/** The os_file_opendir() function opens a directory stream corresponding to the /** The os_file_opendir() function opens a directory stream corresponding to the
directory named by the dirname argument. The directory stream is positioned directory named by the dirname argument. The directory stream is positioned
......
...@@ -496,7 +496,7 @@ void lock_sys_t::create(ulint n_cells) ...@@ -496,7 +496,7 @@ void lock_sys_t::create(ulint n_cells)
prdt_page_hash = hash_create(n_cells); prdt_page_hash = hash_create(n_cells);
if (!srv_read_only_mode) { if (!srv_read_only_mode) {
lock_latest_err_file = os_file_create_tmpfile(NULL); lock_latest_err_file = os_file_create_tmpfile();
ut_a(lock_latest_err_file); ut_a(lock_latest_err_file);
} }
} }
......
...@@ -1215,19 +1215,16 @@ AIO::release_with_mutex(Slot* slot) ...@@ -1215,19 +1215,16 @@ AIO::release_with_mutex(Slot* slot)
release(); release();
} }
/** Creates a temporary file. This function is like tmpfile(3), but /** Create a temporary file. This function is like tmpfile(3), but
the temporary file is created in the given parameter path. If the path the temporary file is created in the in the mysql server configuration
is NULL then it will create the file in the MySQL server configuration
parameter (--tmpdir). parameter (--tmpdir).
@param[in] path location for creating temporary file @return temporary file handle, or NULL on error */
@@return temporary file handle, or NULL on error */
FILE* FILE*
os_file_create_tmpfile( os_file_create_tmpfile()
const char* path)
{ {
FILE* file = NULL; FILE* file = NULL;
WAIT_ALLOW_WRITES(); WAIT_ALLOW_WRITES();
int fd = innobase_mysql_tmpfile(path); int fd = innobase_mysql_tmpfile(NULL);
if (fd >= 0) { if (fd >= 0) {
file = fdopen(fd, "w+b"); file = fdopen(fd, "w+b");
......
...@@ -1754,7 +1754,7 @@ innobase_start_or_create_for_mysql() ...@@ -1754,7 +1754,7 @@ innobase_start_or_create_for_mysql()
} else { } else {
srv_monitor_file_name = NULL; srv_monitor_file_name = NULL;
srv_monitor_file = os_file_create_tmpfile(NULL); srv_monitor_file = os_file_create_tmpfile();
if (!srv_monitor_file && err == DB_SUCCESS) { if (!srv_monitor_file && err == DB_SUCCESS) {
err = DB_ERROR; err = DB_ERROR;
...@@ -1764,7 +1764,7 @@ innobase_start_or_create_for_mysql() ...@@ -1764,7 +1764,7 @@ innobase_start_or_create_for_mysql()
mutex_create(LATCH_ID_SRV_MISC_TMPFILE, mutex_create(LATCH_ID_SRV_MISC_TMPFILE,
&srv_misc_tmpfile_mutex); &srv_misc_tmpfile_mutex);
srv_misc_tmpfile = os_file_create_tmpfile(NULL); srv_misc_tmpfile = os_file_create_tmpfile();
if (!srv_misc_tmpfile && err == DB_SUCCESS) { if (!srv_misc_tmpfile && err == DB_SUCCESS) {
err = DB_ERROR; err = DB_ERROR;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment