13
13
along with this program; if not, write to the Free Software
14
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
18
#include "drizzled/internal/my_sys.h"
19
#include "drizzled/error.h"
20
#include "drizzled/internal/m_string.h"
16
#include "mysys_priv.h"
18
#include "mysys_err.h"
27
22
/* On unix rename deletes to file if it exists */
29
24
int my_rename(const char *from, const char *to, myf MyFlags)
27
DBUG_ENTER("my_rename");
28
DBUG_PRINT("my",("from %s to %s MyFlags %d", from, to, MyFlags));
33
30
#if defined(HAVE_FILE_VERSIONS)
34
31
{ /* Check that there isn't a old file */
36
33
MY_STAT my_stat_result;
38
35
if (my_stat(to,&my_stat_result,MYF(0)))
42
39
if (MyFlags & MY_FAE+MY_WME)
43
my_error(EE_LINK, MYF(ME_BELL+ME_WAITTANG),from,to,errno);
40
my_error(EE_LINK, MYF(ME_BELL+ME_WAITTANG),from,to,my_errno);
46
#if defined(HAVE_RENAME)
49
47
if (rename(from,to))
49
if (link(from, to) || unlink(from))
53
54
if (MyFlags & (MY_FAE+MY_WME))
54
my_error(EE_LINK, MYF(ME_BELL+ME_WAITTANG),from,to,errno);
55
my_error(EE_LINK, MYF(ME_BELL+ME_WAITTANG),from,to,my_errno);
56
57
else if (MyFlags & MY_SYNC_DIR)