~ubuntu-branches/ubuntu/maverick/mysql-5.1/maverick-proposed

« back to all changes in this revision

Viewing changes to mysys/my_copy.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 14:16:05 UTC
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: package-import@ubuntu.com-20120222141605-nxlu9yzc6attylc2
Tags: upstream-5.1.61
ImportĀ upstreamĀ versionĀ 5.1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2000 MySQL AB
 
1
/*
 
2
   Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
2
3
 
3
4
   This program is free software; you can redistribute it and/or modify
4
5
   it under the terms of the GNU General Public License as published by
11
12
 
12
13
   You should have received a copy of the GNU General Public License
13
14
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
 
16
*/
15
17
 
16
18
#include "mysys_priv.h"
17
19
#include <my_dir.h> /* for stat */
18
20
#include <m_string.h>
 
21
#include "mysys_err.h"
19
22
#if defined(HAVE_UTIME_H)
20
23
#include <utime.h>
21
24
#elif defined(HAVE_SYS_UTIME_H)
56
59
  File from_file,to_file;
57
60
  uchar buff[IO_SIZE];
58
61
  MY_STAT stat_buff,new_stat_buff;
59
 
  int res;
60
62
  DBUG_ENTER("my_copy");
61
63
  DBUG_PRINT("my",("from %s to %s MyFlags %d", from, to, MyFlags));
62
64
 
102
104
 
103
105
    if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat)
104
106
        DBUG_RETURN(0);                 /* File copyed but not stat */
105
 
    res= chmod(to, stat_buff.st_mode & 07777); /* Copy modes */
 
107
    /* Copy modes */
 
108
    if (chmod(to, stat_buff.st_mode & 07777))
 
109
    {
 
110
      my_errno= errno;
 
111
      if (MyFlags & (MY_FAE+MY_WME))
 
112
        my_error(EE_CHANGE_PERMISSIONS, MYF(ME_BELL+ME_WAITTANG), from, errno);
 
113
      goto err;
 
114
    }
106
115
#if !defined(__WIN__) && !defined(__NETWARE__)
107
 
    res= chown(to, stat_buff.st_uid,stat_buff.st_gid); /* Copy ownership */
 
116
    /* Copy ownership */
 
117
    if (chown(to, stat_buff.st_uid,stat_buff.st_gid))
 
118
    {
 
119
      my_errno= errno;
 
120
      if (MyFlags & (MY_FAE+MY_WME))
 
121
        my_error(EE_CHANGE_OWNERSHIP, MYF(ME_BELL+ME_WAITTANG), from, errno);
 
122
      goto err;
 
123
    }
108
124
#endif
109
125
#if !defined(VMS) && !defined(__ZTC__)
110
126
    if (MyFlags & MY_COPYTIME)