18 #include <drizzled/internal/my_sys.h>
19 #include <drizzled/internal/m_string.h>
20 #include <drizzled/error.h>
21 #if defined(HAVE_UTIME_H)
23 #elif defined(HAVE_SYS_UTIME_H)
24 #include <sys/utime.h>
25 #elif !defined(HPUX10)
31 #ifdef HAVE_SYS_STAT_H
32 # include <sys/stat.h>
49 int my_redel(
const char *org_name,
const char *tmp_name, myf MyFlags)
53 if (my_copystat(org_name,tmp_name,MyFlags) < 0)
55 if (my_delete(org_name, MyFlags))
57 if (my_rename(tmp_name,org_name,MyFlags))
69 int my_copystat(
const char *from,
const char *to,
int MyFlags)
73 if (stat((
char*) from, &statbuf))
76 if (MyFlags & (MY_FAE+MY_WME))
77 my_error(EE_STAT, MYF(ME_BELL+ME_WAITTANG),from,errno);
80 if ((statbuf.st_mode & S_IFMT) != S_IFREG)
82 chmod(to, statbuf.st_mode & 07777);
84 if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING)
86 if (MyFlags & MY_LINK_WARNING)
87 my_error(EE_LINK_WARNING,MYF(ME_BELL+ME_WAITTANG),from,statbuf.st_nlink);
89 if(chown(to, statbuf.st_uid, statbuf.st_gid)!=0)
93 if (MyFlags & MY_COPYTIME)
96 timep.actime = statbuf.st_atime;
97 timep.modtime = statbuf.st_mtime;
98 utime((
char*) to, &timep);
101 if (MyFlags & MY_COPYTIME)
104 time[0]= statbuf.st_atime;
105 time[1]= statbuf.st_mtime;
106 utime((
char*) to, time);