~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_copy.c

  • Committer: Jay Pipes
  • Date: 2008-07-17 21:21:21 UTC
  • mto: This revision was merged to the branch mainline in revision 182.
  • Revision ID: jay@mysql.com-20080717212121-5qx4zm1fbqkz8ss0
Phase 6 - Remove DBUG from mysys

Show diffs side-by-side

added added

removed removed

Lines of Context:
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));
61
59
 
62
60
  from_file=to_file= -1;
63
 
  DBUG_ASSERT(!(MyFlags & (MY_FNABP | MY_NABP))); /* for my_read/my_write */
 
61
  assert(!(MyFlags & (MY_FNABP | MY_NABP))); /* for my_read/my_write */
64
62
  if (MyFlags & MY_HOLD_ORIGINAL_MODES)         /* Copy stat if possible */
65
63
    new_file_stat= test(!stat((char*) to, &new_stat_buff));
66
64
 
88
86
    }
89
87
 
90
88
    if (my_close(from_file,MyFlags) | my_close(to_file,MyFlags))
91
 
      DBUG_RETURN(-1);                          /* Error on close */
 
89
      return(-1);                               /* Error on close */
92
90
 
93
91
    /* Copy modes if possible */
94
92
 
95
93
    if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat)
96
 
        DBUG_RETURN(0);                 /* File copyed but not stat */
 
94
        return(0);                      /* File copyed but not stat */
97
95
    VOID(chmod(to, stat_buff.st_mode & 07777)); /* Copy modes */
98
96
    VOID(chown(to, stat_buff.st_uid,stat_buff.st_gid)); /* Copy ownership */
99
97
    if (MyFlags & MY_COPYTIME)
103
101
      timep.modtime = stat_buff.st_mtime;
104
102
      VOID(utime((char*) to, &timep)); /* last accessed and modified times */
105
103
    }
106
 
    DBUG_RETURN(0);
 
104
    return(0);
107
105
  }
108
106
 
109
107
err:
114
112
    /* attempt to delete the to-file we've partially written */
115
113
    VOID(my_delete(to, MyFlags));
116
114
  }
117
 
  DBUG_RETURN(-1);
 
115
  return(-1);
118
116
} /* my_copy */