~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/internal/my_rename.cc

  • Committer: Brian Aker
  • Date: 2009-12-29 01:38:38 UTC
  • mfrom: (1251.1.1 drizzle)
  • Revision ID: brian@gaz-20091229013838-03kb2z5xbqw03ddt
Merge of Diego fix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 */
15
15
 
16
 
#include "mysys_priv.h"
17
 
#include <my_dir.h>
18
 
#include "mysys_err.h"
19
 
#include <mystrings/m_string.h>
 
16
#include "drizzled/internal/mysys_priv.h"
 
17
#include "drizzled/my_error.h"
 
18
#include "drizzled/internal/m_string.h"
20
19
#undef my_rename
21
20
 
22
21
        /* On unix rename deletes to file if it exists */
29
28
  {                             /* Check that there isn't a old file */
30
29
    int save_errno;
31
30
    MY_STAT my_stat_result;
32
 
    save_errno=my_errno;
 
31
    save_errno=errno;
33
32
    if (my_stat(to,&my_stat_result,MYF(0)))
34
33
    {
35
 
      my_errno=EEXIST;
 
34
      errno=EEXIST;
36
35
      error= -1;
37
36
      if (MyFlags & MY_FAE+MY_WME)
38
 
        my_error(EE_LINK, MYF(ME_BELL+ME_WAITTANG),from,to,my_errno);
 
37
        my_error(EE_LINK, MYF(ME_BELL+ME_WAITTANG),from,to,errno);
39
38
      return(error);
40
39
    }
41
 
    my_errno=save_errno;
 
40
    errno=save_errno;
42
41
  }
43
42
#endif
44
 
#if defined(HAVE_RENAME)
45
43
  if (rename(from,to))
46
 
#else
47
 
  if (link(from, to) || unlink(from))
48
 
#endif
49
44
  {
50
 
    my_errno=errno;
 
45
    errno=errno;
51
46
    error = -1;
52
47
    if (MyFlags & (MY_FAE+MY_WME))
53
 
      my_error(EE_LINK, MYF(ME_BELL+ME_WAITTANG),from,to,my_errno);
 
48
      my_error(EE_LINK, MYF(ME_BELL+ME_WAITTANG),from,to,errno);
54
49
  }
55
50
  else if (MyFlags & MY_SYNC_DIR)
56
51
  {