16 #include "mysys_priv.h"
17 #include "mysys_err.h"
20 int my_delete(
const char *
name, myf MyFlags)
23 DBUG_ENTER(
"my_delete");
24 DBUG_PRINT(
"my",(
"name %s MyFlags %d", name, MyFlags));
26 if ((err = unlink(name)) == -1)
29 if (MyFlags & (MY_FAE+MY_WME))
31 char errbuf[MYSYS_STRERROR_SIZE];
32 my_error(EE_DELETE, MYF(ME_BELL+ME_WAITTANG+(MyFlags & ME_NOINPUT)),
33 name, errno, my_strerror(errbuf,
sizeof(errbuf), errno));
36 else if ((MyFlags & MY_SYNC_DIR) &&
37 my_sync_dir_by_file(name, MyFlags))
74 int nt_share_delete(
const char *name, myf MyFlags)
76 char buf[MAX_PATH + 20];
78 DBUG_ENTER(
"nt_share_delete");
79 DBUG_PRINT(
"my",(
"name %s MyFlags %d", name, MyFlags));
81 for (cnt= GetTickCount(); cnt; cnt--)
84 sprintf(buf,
"%s.%08X.deleted", name, cnt);
85 if (MoveFile(name, buf))
88 if ((errno= GetLastError()) == ERROR_ALREADY_EXISTS)
92 if (errno == ERROR_ACCESS_DENIED)
95 DBUG_PRINT(
"warning", (
"Failed to rename %s to %s, errno: %d",
100 if (errno == ERROR_FILE_NOT_FOUND)
114 errno= GetLastError();
123 if (MyFlags & (MY_FAE+MY_WME))
125 char errbuf[MYSYS_STRERROR_SIZE];
126 my_error(EE_DELETE, MYF(ME_BELL + ME_WAITTANG + (MyFlags & ME_NOINPUT)),
127 name, my_errno, my_strerror(errbuf,
sizeof(errbuf), my_errno));