~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_copy.c

  • Committer: Monty Taylor
  • Date: 2008-10-05 01:41:06 UTC
  • Revision ID: monty@inaugust.com-20081005014106-bulqe4kp7i6ipts1
Moved qsort declarations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
};
29
29
#endif
30
30
 
31
 
#include <drizzled/util/test.h>
32
31
 
33
32
/*
34
33
  int my_copy(const char *from, const char *to, myf MyFlags)
51
50
 
52
51
int my_copy(const char *from, const char *to, myf MyFlags)
53
52
{
54
 
  uint32_t Count;
 
53
  uint Count;
55
54
  bool new_file_stat= 0; /* 1 if we could stat "to" */
56
55
  int create_flag;
57
56
  File from_file,to_file;
58
 
  unsigned char buff[IO_SIZE];
 
57
  uchar buff[IO_SIZE];
59
58
  struct stat stat_buff,new_stat_buff;
60
59
 
61
60
  from_file=to_file= -1;
63
62
  if (MyFlags & MY_HOLD_ORIGINAL_MODES)         /* Copy stat if possible */
64
63
    new_file_stat= test(!stat((char*) to, &new_stat_buff));
65
64
 
66
 
  if ((from_file=my_open(from,O_RDONLY,MyFlags)) >= 0)
 
65
  if ((from_file=my_open(from,O_RDONLY | O_SHARE,MyFlags)) >= 0)
67
66
  {
68
67
    if (stat(from, &stat_buff))
69
68
    {
75
74
    create_flag= (MyFlags & MY_DONT_OVERWRITE_FILE) ? O_EXCL : O_TRUNC;
76
75
 
77
76
    if ((to_file=  my_create(to,(int) stat_buff.st_mode,
78
 
                             O_WRONLY | create_flag,
 
77
                             O_WRONLY | create_flag | O_BINARY | O_SHARE,
79
78
                             MyFlags)) < 0)
80
79
      goto err;
81
80