~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_copy.c

Removed/replaced DBUG symbols and TRUE/FALSE

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
int my_copy(const char *from, const char *to, myf MyFlags)
52
52
{
53
53
  uint Count;
54
 
  bool new_file_stat= 0; /* 1 if we could stat "to" */
 
54
  my_bool new_file_stat= 0; /* 1 if we could stat "to" */
55
55
  int create_flag;
56
56
  File from_file,to_file;
57
57
  uchar buff[IO_SIZE];
58
58
  struct stat stat_buff,new_stat_buff;
 
59
  DBUG_ENTER("my_copy");
 
60
  DBUG_PRINT("my",("from %s to %s MyFlags %d", from, to, MyFlags));
59
61
 
60
62
  from_file=to_file= -1;
61
 
  assert(!(MyFlags & (MY_FNABP | MY_NABP))); /* for my_read/my_write */
 
63
  DBUG_ASSERT(!(MyFlags & (MY_FNABP | MY_NABP))); /* for my_read/my_write */
62
64
  if (MyFlags & MY_HOLD_ORIGINAL_MODES)         /* Copy stat if possible */
63
65
    new_file_stat= test(!stat((char*) to, &new_stat_buff));
64
66
 
86
88
    }
87
89
 
88
90
    if (my_close(from_file,MyFlags) | my_close(to_file,MyFlags))
89
 
      return(-1);                               /* Error on close */
 
91
      DBUG_RETURN(-1);                          /* Error on close */
90
92
 
91
93
    /* Copy modes if possible */
92
94
 
93
95
    if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat)
94
 
        return(0);                      /* File copyed but not stat */
 
96
        DBUG_RETURN(0);                 /* File copyed but not stat */
95
97
    VOID(chmod(to, stat_buff.st_mode & 07777)); /* Copy modes */
96
98
    VOID(chown(to, stat_buff.st_uid,stat_buff.st_gid)); /* Copy ownership */
97
99
    if (MyFlags & MY_COPYTIME)
101
103
      timep.modtime = stat_buff.st_mtime;
102
104
      VOID(utime((char*) to, &timep)); /* last accessed and modified times */
103
105
    }
104
 
    return(0);
 
106
    DBUG_RETURN(0);
105
107
  }
106
108
 
107
109
err:
112
114
    /* attempt to delete the to-file we've partially written */
113
115
    VOID(my_delete(to, MyFlags));
114
116
  }
115
 
  return(-1);
 
117
  DBUG_RETURN(-1);
116
118
} /* my_copy */