18#include <drizzled/internal/my_sys.h>
19#include <drizzled/internal/m_string.h>
20#include <drizzled/error.h>
38int my_redel(
const char *org_name,
const char *tmp_name, myf MyFlags)
42 if (my_copystat(org_name,tmp_name,MyFlags) < 0)
44 if (my_delete(org_name, MyFlags))
46 if (my_rename(tmp_name,org_name,MyFlags))
58int my_copystat(
const char *from,
const char *to,
int MyFlags)
62 if (stat((
char*) from, &statbuf))
65 if (MyFlags & (MY_FAE+MY_WME))
66 my_error(EE_STAT, MYF(ME_BELL+ME_WAITTANG),from,errno);
69 if ((statbuf.st_mode & S_IFMT) != S_IFREG)
71 chmod(to, statbuf.st_mode & 07777);
73 if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING)
75 if (MyFlags & MY_LINK_WARNING)
76 my_error(EE_LINK_WARNING,MYF(ME_BELL+ME_WAITTANG),from,statbuf.st_nlink);
78 if(chown(to, statbuf.st_uid, statbuf.st_gid)!=0)
82 if (MyFlags & MY_COPYTIME)
85 timep.actime = statbuf.st_atime;
86 timep.modtime = statbuf.st_mtime;
87 utime((
char*) to, &timep);
90 if (MyFlags & MY_COPYTIME)
93 time[0]= statbuf.st_atime;
94 time[1]= statbuf.st_mtime;
95 utime((
char*) to, time);
TODO: Rename this file - func.h is stupid.