~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_rename.cc

  • Committer: Monty Taylor
  • Date: 2009-12-23 08:01:21 UTC
  • mto: This revision was merged to the branch mainline in revision 1253.
  • Revision ID: mordred@inaugust.com-20091223080121-iveugdrewkp7iqyi
Oy. Bigger change than I normally like - but this stuff is all intertwined.
Moved a bunch of things to public drizzled/ area. Split some files. Made some
convenience libs. EVENTUALLY, some of this will be able to be re-factored, but
for now I'm ok with erring on the side of too many files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
#include "mysys/mysys_priv.h"
17
 
#include "mysys/mysys_err.h"
 
17
#include "drizzled/my_error.h"
18
18
#include <mystrings/m_string.h>
19
19
#undef my_rename
20
20
 
28
28
  {                             /* Check that there isn't a old file */
29
29
    int save_errno;
30
30
    MY_STAT my_stat_result;
31
 
    save_errno=my_errno;
 
31
    save_errno=errno;
32
32
    if (my_stat(to,&my_stat_result,MYF(0)))
33
33
    {
34
 
      my_errno=EEXIST;
 
34
      errno=EEXIST;
35
35
      error= -1;
36
36
      if (MyFlags & MY_FAE+MY_WME)
37
 
        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);
38
38
      return(error);
39
39
    }
40
 
    my_errno=save_errno;
 
40
    errno=save_errno;
41
41
  }
42
42
#endif
43
43
  if (rename(from,to))
44
44
  {
45
 
    my_errno=errno;
 
45
    errno=errno;
46
46
    error = -1;
47
47
    if (MyFlags & (MY_FAE+MY_WME))
48
 
      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);
49
49
  }
50
50
  else if (MyFlags & MY_SYNC_DIR)
51
51
  {