os0file.c:

  Fix Windows porting bugs that broke ibbackup: 1) wrong error check in for CreateDirectory(), 2) wrong error check if the file did not exist in DeleteFile(), 3) too strict sharing restrictions in os_file_create_simple(): when ibbackup called that function, it would not allow mysqld to write to the file
parent 9218a06e
...@@ -823,7 +823,7 @@ os_file_create_directory( ...@@ -823,7 +823,7 @@ os_file_create_directory(
rcode = CreateDirectory(pathname, NULL); rcode = CreateDirectory(pathname, NULL);
if (!(rcode != 0 || if (!(rcode != 0 ||
(GetLastError() == ERROR_FILE_EXISTS && !fail_if_exists))) { (GetLastError() == ERROR_ALREADY_EXISTS && !fail_if_exists))) {
/* failure */ /* failure */
os_file_handle_error(pathname, "CreateDirectory"); os_file_handle_error(pathname, "CreateDirectory");
...@@ -907,8 +907,9 @@ os_file_create_simple( ...@@ -907,8 +907,9 @@ os_file_create_simple(
file = CreateFile(name, file = CreateFile(name,
access, access,
FILE_SHARE_READ,/* file can be read also by other FILE_SHARE_READ | FILE_SHARE_WRITE,
processes */ /* file can be read ansd written also
by other processes */
NULL, /* default security attributes */ NULL, /* default security attributes */
create_flag, create_flag,
attributes, attributes,
...@@ -1013,7 +1014,7 @@ os_file_create_simple_no_error_handling( ...@@ -1013,7 +1014,7 @@ os_file_create_simple_no_error_handling(
DWORD create_flag; DWORD create_flag;
DWORD access; DWORD access;
DWORD attributes = 0; DWORD attributes = 0;
DWORD share_mode = FILE_SHARE_READ; DWORD share_mode = FILE_SHARE_READ | FILE_SHARE_WRITE;
ut_a(name); ut_a(name);
...@@ -1336,7 +1337,7 @@ os_file_delete_if_exists( ...@@ -1336,7 +1337,7 @@ os_file_delete_if_exists(
return(TRUE); return(TRUE);
} }
if (GetLastError() == ERROR_PATH_NOT_FOUND) { if (GetLastError() == ERROR_FILE_NOT_FOUND) {
/* the file does not exist, this not an error */ /* the file does not exist, this not an error */
return(TRUE); return(TRUE);
...@@ -1397,7 +1398,7 @@ os_file_delete( ...@@ -1397,7 +1398,7 @@ os_file_delete(
return(TRUE); return(TRUE);
} }
if (GetLastError() == ERROR_PATH_NOT_FOUND) { if (GetLastError() == ERROR_FILE_NOT_FOUND) {
/* If the file does not exist, we classify this as a 'mild' /* If the file does not exist, we classify this as a 'mild'
error and return */ error and return */
......
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