diff options
author | heikki@hundin.mysql.fi <> | 2004-06-03 17:02:37 +0300 |
---|---|---|
committer | heikki@hundin.mysql.fi <> | 2004-06-03 17:02:37 +0300 |
commit | 0dced9ea3b6dd4b4a2f61a52360788065a1ef361 (patch) | |
tree | c49ae981e47b6bba67b478bef11dcffadf402075 /innobase/os | |
parent | 73a4598cdf98f1d1e50c854aa9e961cafc031653 (diff) | |
download | mariadb-git-0dced9ea3b6dd4b4a2f61a52360788065a1ef361.tar.gz |
os0file.c, fil0fil.c:
Align file i/o buffers for DIRECT_IO; fix mem_alloc()/mem_free() crash bugs that came from Marko's latest cleanup
Diffstat (limited to 'innobase/os')
-rw-r--r-- | innobase/os/os0file.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c index fafed2a484c..57e9690d990 100644 --- a/innobase/os/os0file.c +++ b/innobase/os/os0file.c @@ -2341,21 +2341,24 @@ os_file_dirname( pathname */ const char* path) /* in: pathname */ { - /* find the offset of the last slash */ + /* Find the offset of the last slash */ const char* last_slash = strrchr(path, OS_FILE_PATH_SEPARATOR); if (!last_slash) { - /* no slash in the path, return "." */ + /* No slash in the path, return "." */ + return(mem_strdup(".")); } - /* ok, there is a slash */ + /* Ok, there is a slash */ if (last_slash == path) { /* last slash is the first char of the path */ + return(mem_strdup("/")); } - /* non-trivial directory component */ + /* Non-trivial directory component */ + return(mem_strdupl(path, last_slash - path)); } @@ -2377,23 +2380,26 @@ os_file_create_subdirs_if_needed( if (strlen(subdir) == 1 && (*subdir == OS_FILE_PATH_SEPARATOR || *subdir == '.')) { /* subdir is root or cwd, nothing to do */ - ut_free(subdir); + mem_free(subdir); + return(TRUE); } - /* test if subdir exists */ + /* Test if subdir exists */ success = os_file_status(subdir, &subdir_exists, &type); if (success && !subdir_exists) { /* subdir does not exist, create it */ success = os_file_create_subdirs_if_needed(subdir); if (!success) { - ut_free(subdir); + mem_free(subdir); + return(FALSE); } success = os_file_create_directory(subdir, FALSE); } - ut_free(subdir); + mem_free(subdir); + return(success); } |