~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_redel.cc

  • Committer: Brian Aker
  • Date: 2009-07-11 19:23:04 UTC
  • mfrom: (1089.1.14 merge)
  • Revision ID: brian@gaz-20090711192304-ootijyl5yf9jq9kd
Merge Brian

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>
 
16
#include "mysys/mysys_priv.h"
18
17
#include <mystrings/m_string.h>
19
 
#include "mysys_err.h"
 
18
#include "mysys/mysys_err.h"
20
19
#if defined(HAVE_UTIME_H)
21
20
#include <utime.h>
22
21
#elif defined(HAVE_SYS_UTIME_H)
47
46
    goto end;
48
47
  if (MyFlags & MY_REDEL_MAKE_BACKUP)
49
48
  {
50
 
    char name_buff[FN_REFLEN+20];    
 
49
    char name_buff[FN_REFLEN+20];
51
50
    char ext[20];
52
51
    ext[0]='-';
53
52
    get_date(ext+1,2+4,(time_t) 0);
54
 
    stpcpy(strend(ext),REDEL_EXT);
 
53
    strcpy(strchr(ext, '\0'),REDEL_EXT);
55
54
    if (my_rename(org_name, fn_format(name_buff, org_name, "", ext, 2),
56
55
                  MyFlags))
57
56
      goto end;
83
82
  }
84
83
  if ((statbuf.st_mode & S_IFMT) != S_IFREG)
85
84
    return 1;
86
 
  VOID(chmod(to, statbuf.st_mode & 07777));             /* Copy modes */
 
85
  chmod(to, statbuf.st_mode & 07777);           /* Copy modes */
87
86
 
88
87
  if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING)
89
88
  {
90
89
    if (MyFlags & MY_LINK_WARNING)
91
90
      my_error(EE_LINK_WARNING,MYF(ME_BELL+ME_WAITTANG),from,statbuf.st_nlink);
92
91
  }
93
 
  VOID(chown(to, statbuf.st_uid, statbuf.st_gid));      /* Copy ownership */
 
92
  if(chown(to, statbuf.st_uid, statbuf.st_gid)!=0)
 
93
    return 1;
94
94
 
95
95
#ifndef __ZTC__
96
96
  if (MyFlags & MY_COPYTIME)
98
98
    struct utimbuf timep;
99
99
    timep.actime  = statbuf.st_atime;
100
100
    timep.modtime = statbuf.st_mtime;
101
 
    VOID(utime((char*) to, &timep));/* Update last accessed and modified times */
 
101
    utime((char*) to, &timep);/* Update last accessed and modified times */
102
102
  }
103
103
#else
104
104
  if (MyFlags & MY_COPYTIME)
106
106
    time_t time[2];
107
107
    time[0]= statbuf.st_atime;
108
108
    time[1]= statbuf.st_mtime;
109
 
    VOID(utime((char*) to, time));/* Update last accessed and modified times */
 
109
    utime((char*) to, time);/* Update last accessed and modified times */
110
110
  }
111
111
#endif
112
112
  return 0;