summaryrefslogtreecommitdiff
path: root/mysys/my_redel.c
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2010-11-25 18:17:28 +0100
committerSergei Golubchik <sergii@pisem.net>2010-11-25 18:17:28 +0100
commit65ca700def99289cc31a7040537f5aa6e12bf485 (patch)
tree97b3a07299b626c519da0e80c122b5b79b933914 /mysys/my_redel.c
parent2ab57de38d13d927ddff2d51aed4af34e13998f5 (diff)
parent6e5bcca7935d3c62f84bb640e5357664a210ee12 (diff)
downloadmariadb-git-65ca700def99289cc31a7040537f5aa6e12bf485.tar.gz
merge.
checkpoint. does not compile.
Diffstat (limited to 'mysys/my_redel.c')
-rw-r--r--mysys/my_redel.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/mysys/my_redel.c b/mysys/my_redel.c
index 92aa6e42073..2fa5832bf0d 100644
--- a/mysys/my_redel.c
+++ b/mysys/my_redel.c
@@ -14,6 +14,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "mysys_priv.h"
+#include "mysys_err.h"
#include <my_dir.h>
#include <m_string.h>
#include "mysys_err.h"
@@ -70,8 +71,22 @@ end:
} /* my_redel */
- /* Copy stat from one file to another */
- /* Return -1 if can't get stat, 1 if wrong type of file */
+/**
+ Copy stat from one file to another
+ @fn my_copystat()
+ @param from Copy stat from this file
+ @param to Copy stat to this file
+ @param MyFlags Flags:
+ MY_WME Give error if something goes wrong
+ MY_FAE Abort operation if something goes wrong
+ If MY_FAE is not given, we don't return -1 for
+ errors from chown (which normally require root
+ privilege)
+
+ @return 0 ok
+ -1 if can't get stat,
+ 1 if wrong type of file
+*/
int my_copystat(const char *from, const char *to, int MyFlags)
{
@@ -106,9 +121,10 @@ int my_copystat(const char *from, const char *to, int MyFlags)
if (chown(to, statbuf.st_uid, statbuf.st_gid))
{
my_errno= errno;
- if (MyFlags & (MY_FAE+MY_WME))
+ if (MyFlags & MY_WME)
my_error(EE_CHANGE_OWNERSHIP, MYF(ME_BELL+ME_WAITTANG), from, errno);
- return -1;
+ if (MyFlags & MY_FAE)
+ return -1;
}
#endif /* !__WIN__ */