diff options
author | Davi Arnaut <davi.arnaut@oracle.com> | 2010-07-20 16:30:10 -0300 |
---|---|---|
committer | Davi Arnaut <davi.arnaut@oracle.com> | 2010-07-20 16:30:10 -0300 |
commit | 182599dd13f280ce4d51333bca98dbd5e4816bba (patch) | |
tree | c02d7fe89f0e9d9cbd05e83dd77ceeed812eb293 /mysys/my_redel.c | |
parent | 774194634297aebf6ecbbda7c5601c796f43e5fc (diff) | |
parent | 9a5fa17fd3c4885262e31bf14cf495d02e5f6b27 (diff) | |
download | mariadb-git-182599dd13f280ce4d51333bca98dbd5e4816bba.tar.gz |
Merge of mysql-5.1-bugteam into mysql-trunk-merge.
Diffstat (limited to 'mysys/my_redel.c')
-rw-r--r-- | mysys/my_redel.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/mysys/my_redel.c b/mysys/my_redel.c index 300bac6e296..92aa6e42073 100644 --- a/mysys/my_redel.c +++ b/mysys/my_redel.c @@ -76,11 +76,8 @@ end: int my_copystat(const char *from, const char *to, int MyFlags) { struct stat statbuf; -#if !defined(__WIN__) - int res; -#endif - if (stat((char*) from, &statbuf)) + if (stat(from, &statbuf)) { my_errno=errno; if (MyFlags & (MY_FAE+MY_WME)) @@ -89,7 +86,15 @@ int my_copystat(const char *from, const char *to, int MyFlags) } if ((statbuf.st_mode & S_IFMT) != S_IFREG) return 1; - (void) chmod(to, statbuf.st_mode & 07777); /* Copy modes */ + + /* Copy modes */ + if (chmod(to, statbuf.st_mode & 07777)) + { + my_errno= errno; + if (MyFlags & (MY_FAE+MY_WME)) + my_error(EE_CHANGE_PERMISSIONS, MYF(ME_BELL+ME_WAITTANG), from, errno); + return -1; + } #if !defined(__WIN__) if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING) @@ -97,7 +102,14 @@ int my_copystat(const char *from, const char *to, int MyFlags) if (MyFlags & MY_LINK_WARNING) my_error(EE_LINK_WARNING,MYF(ME_BELL+ME_WAITTANG),from,statbuf.st_nlink); } - res= chown(to, statbuf.st_uid, statbuf.st_gid); /* Copy ownership */ + /* Copy ownership */ + if (chown(to, statbuf.st_uid, statbuf.st_gid)) + { + my_errno= errno; + if (MyFlags & (MY_FAE+MY_WME)) + my_error(EE_CHANGE_OWNERSHIP, MYF(ME_BELL+ME_WAITTANG), from, errno); + return -1; + } #endif /* !__WIN__ */ if (MyFlags & MY_COPYTIME) |