~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_rename.c

  • Committer: Monty Taylor
  • Date: 2008-08-16 21:06:22 UTC
  • Revision ID: monty@inaugust.com-20080816210622-zpnn13unyinqzn72
Updated po files.

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