~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_redel.c

  • Committer: Monty Taylor
  • Date: 2008-10-16 06:32:30 UTC
  • mto: (511.1.5 codestyle)
  • mto: This revision was merged to the branch mainline in revision 521.
  • Revision ID: monty@inaugust.com-20081016063230-4brxsra0qsmsg84q
Added -Wunused-macros.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
#include "mysys_priv.h"
17
17
#include <my_dir.h>
18
 
#include <m_string.h>
 
18
#include <mystrings/m_string.h>
19
19
#include "mysys_err.h"
20
20
#if defined(HAVE_UTIME_H)
21
21
#include <utime.h>
42
42
int my_redel(const char *org_name, const char *tmp_name, myf MyFlags)
43
43
{
44
44
  int error=1;
45
 
  DBUG_ENTER("my_redel");
46
 
  DBUG_PRINT("my",("org_name: '%s' tmp_name: '%s'  MyFlags: %d",
47
 
                   org_name,tmp_name,MyFlags));
48
45
 
49
46
  if (my_copystat(org_name,tmp_name,MyFlags) < 0)
50
47
    goto end;
54
51
    char ext[20];
55
52
    ext[0]='-';
56
53
    get_date(ext+1,2+4,(time_t) 0);
57
 
    strmov(strend(ext),REDEL_EXT);
 
54
    my_stpcpy(strchr(ext, '\0'),REDEL_EXT);
58
55
    if (my_rename(org_name, fn_format(name_buff, org_name, "", ext, 2),
59
56
                  MyFlags))
60
57
      goto end;
66
63
 
67
64
  error=0;
68
65
end:
69
 
  DBUG_RETURN(error);
 
66
  return(error);
70
67
} /* my_redel */
71
68
 
72
69
 
86
83
  }
87
84
  if ((statbuf.st_mode & S_IFMT) != S_IFREG)
88
85
    return 1;
89
 
  VOID(chmod(to, statbuf.st_mode & 07777));             /* Copy modes */
 
86
  chmod(to, statbuf.st_mode & 07777);           /* Copy modes */
90
87
 
91
88
  if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING)
92
89
  {
93
90
    if (MyFlags & MY_LINK_WARNING)
94
91
      my_error(EE_LINK_WARNING,MYF(ME_BELL+ME_WAITTANG),from,statbuf.st_nlink);
95
92
  }
96
 
  VOID(chown(to, statbuf.st_uid, statbuf.st_gid));      /* Copy ownership */
 
93
  chown(to, statbuf.st_uid, statbuf.st_gid);    /* Copy ownership */
97
94
 
98
95
#ifndef __ZTC__
99
96
  if (MyFlags & MY_COPYTIME)
101
98
    struct utimbuf timep;
102
99
    timep.actime  = statbuf.st_atime;
103
100
    timep.modtime = statbuf.st_mtime;
104
 
    VOID(utime((char*) to, &timep));/* Update last accessed and modified times */
 
101
    utime((char*) to, &timep);/* Update last accessed and modified times */
105
102
  }
106
103
#else
107
104
  if (MyFlags & MY_COPYTIME)
109
106
    time_t time[2];
110
107
    time[0]= statbuf.st_atime;
111
108
    time[1]= statbuf.st_mtime;
112
 
    VOID(utime((char*) to, time));/* Update last accessed and modified times */
 
109
    utime((char*) to, time);/* Update last accessed and modified times */
113
110
  }
114
111
#endif
115
112
  return 0;