summaryrefslogtreecommitdiff
path: root/mysys/my_delete.c
diff options
context:
space:
mode:
authorAndrei Elkin <aelkin@mysql.com>2009-12-01 21:07:18 +0200
committerAndrei Elkin <aelkin@mysql.com>2009-12-01 21:07:18 +0200
commit0eda48463ce9c60408515819f9d954fd48567d4f (patch)
tree39a60b9bbefbde5c02b040d381c8fd5d0c0dc0ea /mysys/my_delete.c
parent3c11750e363da6e1017d5bc86e9e7e03b2c4e101 (diff)
parent80cb81069b43978da39ad99cf7d23fc52deb95d6 (diff)
downloadmariadb-git-0eda48463ce9c60408515819f9d954fd48567d4f.tar.gz
Manual resolving for the following files
Text conflict in mysql-test/collections/default.experimental Text conflict in mysql-test/r/show_check.result Text conflict in mysql-test/r/sp-code.result Text conflict in mysql-test/suite/binlog/r/binlog_tmp_table.result Text conflict in mysql-test/suite/rpl/t/disabled.def Text conflict in mysql-test/t/show_check.test Text conflict in mysys/my_delete.c Text conflict in sql/item.h Text conflict in sql/item_cmpfunc.h Text conflict in sql/log.cc Text conflict in sql/mysqld.cc Text conflict in sql/repl_failsafe.cc Text conflict in sql/slave.cc Text conflict in sql/sql_parse.cc Text conflict in sql/sql_table.cc Text conflict in sql/sql_yacc.yy Text conflict in storage/myisam/ha_myisam.cc Corrected results for stm_auto_increment_bug33029.reject 2009-12-01 20:01:49.000000000 +0300 <andrei> @@ -42,9 +42,6 @@ <andrei> RETURN i; <andrei> END// <andrei> CALL p1(); <andrei> -Warnings: <andrei> -Note 1592 Statement may not be safe to log in statement format. <andrei> -Note 1592 Statement may not be safe to log in statement format. There should be indeed no Note present because there is in fact autoincrement top-level query in sp() that triggers inserting in yet another auto-inc table. (todo: alert DaoGang to improve the test).
Diffstat (limited to 'mysys/my_delete.c')
-rw-r--r--mysys/my_delete.c41
1 files changed, 32 insertions, 9 deletions
diff --git a/mysys/my_delete.c b/mysys/my_delete.c
index 3ab6ba399f9..edee1c4e875 100644
--- a/mysys/my_delete.c
+++ b/mysys/my_delete.c
@@ -37,7 +37,7 @@ int my_delete(const char *name, myf MyFlags)
} /* my_delete */
#if defined(__WIN__)
-/*
+/**
Delete file which is possibly not closed.
This function is intended to be used exclusively as a temporal solution
@@ -53,6 +53,20 @@ int my_delete(const char *name, myf MyFlags)
renamed to <name>.<num>.deleted where <name> - the initial name of the
file, <num> - a hexadecimal number chosen to make the temporal name to
be unique.
+
+ @param the name of the being deleted file
+ @param the flags instructing how to react on an error internally in
+ the function
+
+ @note The per-thread @c my_errno holds additional info for a caller to
+ decide how critical the error can be.
+
+ @retval
+ 0 ok
+ @retval
+ 1 error
+
+
*/
int nt_share_delete(const char *name, myf MyFlags)
{
@@ -63,6 +77,7 @@ int nt_share_delete(const char *name, myf MyFlags)
for (cnt= GetTickCount(); cnt; cnt--)
{
+ errno= 0;
sprintf(buf, "%s.%08X.deleted", name, cnt);
if (MoveFile(name, buf))
break;
@@ -78,15 +93,23 @@ int nt_share_delete(const char *name, myf MyFlags)
name, buf, errno));
break;
}
-
- if (DeleteFile(buf))
- DBUG_RETURN(0);
-
- my_errno= GetLastError();
+
+ if (errno == ERROR_FILE_NOT_FOUND)
+ {
+ my_errno= ENOENT; // marking, that `name' doesn't exist
+ }
+ else if (errno == 0)
+ {
+ if (DeleteFile(buf))
+ DBUG_RETURN(0);
+ else if ((my_errno= GetLastError()) == 0)
+ my_errno= ENOENT; // marking, that `buf' doesn't exist
+ } else
+ my_errno= errno;
+
if (MyFlags & (MY_FAE+MY_WME))
- my_error(EE_DELETE, MYF(ME_BELL + ME_WAITTANG + (MyFlags & ME_NOINPUT)),
- name, my_errno);
-
+ my_error(EE_DELETE, MYF(ME_BELL + ME_WAITTANG + (MyFlags & ME_NOINPUT)),
+ name, my_errno);
DBUG_RETURN(-1);
}
#endif