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

« back to all changes in this revision

Viewing changes to mysys/my_redel.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>
76
78
int my_copystat(const char *from, const char *to, int MyFlags)
77
79
{
78
80
  struct stat statbuf;
79
 
#if !defined(__WIN__) && !defined(__NETWARE__)
80
 
  int res;
81
 
#endif
82
81
 
83
 
  if (stat((char*) from, &statbuf))
 
82
  if (stat(from, &statbuf))
84
83
  {
85
84
    my_errno=errno;
86
85
    if (MyFlags & (MY_FAE+MY_WME))
89
88
  }
90
89
  if ((statbuf.st_mode & S_IFMT) != S_IFREG)
91
90
    return 1;
92
 
  VOID(chmod(to, statbuf.st_mode & 07777));             /* Copy modes */
 
91
 
 
92
  /* Copy modes */
 
93
  if (chmod(to, statbuf.st_mode & 07777))
 
94
  {
 
95
    my_errno= errno;
 
96
    if (MyFlags & (MY_FAE+MY_WME))
 
97
      my_error(EE_CHANGE_PERMISSIONS, MYF(ME_BELL+ME_WAITTANG), from, errno);
 
98
    return -1;
 
99
  }
93
100
 
94
101
#if !defined(__WIN__) && !defined(__NETWARE__)
95
102
  if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING)
97
104
    if (MyFlags & MY_LINK_WARNING)
98
105
      my_error(EE_LINK_WARNING,MYF(ME_BELL+ME_WAITTANG),from,statbuf.st_nlink);
99
106
  }
100
 
  res= chown(to, statbuf.st_uid, statbuf.st_gid);       /* Copy ownership */
 
107
  /* Copy ownership */
 
108
  if (chown(to, statbuf.st_uid, statbuf.st_gid))
 
109
  {
 
110
    my_errno= errno;
 
111
    if (MyFlags & (MY_FAE+MY_WME))
 
112
      my_error(EE_CHANGE_OWNERSHIP, MYF(ME_BELL+ME_WAITTANG), from, errno);
 
113
    return -1;
 
114
  }
101
115
#endif /* !__WIN__ && !__NETWARE__ */
102
116
 
103
117
#ifndef VMS