Auto-merge from mysql-trunk-merge.

This commit is contained in:
Alexander Nozdrin 2010-07-29 16:32:11 +04:00
commit 32f3ab7933
68 changed files with 617 additions and 564 deletions

View file

@ -49,7 +49,9 @@ const char *globerrs[GLOBERRS]=
"Can't sync file '%s' to disk (Errcode: %d)",
"Collation '%s' is not a compiled collation and is not specified in the '%s' file",
"File '%s' not found (Errcode: %d)",
"File '%s' (fileno: %d) was not closed"
"File '%s' (fileno: %d) was not closed",
"Can't change ownership of the file '%s' (Errcode: %d)",
"Can't change permissions of the file '%s' (Errcode: %d)",
};
void init_glob_errs(void)
@ -90,6 +92,8 @@ void init_glob_errs()
EE(EE_UNKNOWN_COLLATION)= "Collation '%s' is not a compiled collation and is not specified in the %s file";
EE(EE_FILENOTFOUND) = "File '%s' not found (Errcode: %d)";
EE(EE_FILE_NOT_CLOSED) = "File '%s' (fileno: %d) was not closed";
EE(EE_CHANGE_OWNERSHIP) = "Can't change ownership of the file '%s' (Errcode: %d)";
EE(EE_CHANGE_PERMISSIONS) = "Can't change permissions of the file '%s' (Errcode: %d)";
}
#endif

View file

@ -1746,16 +1746,19 @@ int my_block_write(register IO_CACHE *info, const uchar *Buffer, size_t Count,
#endif
int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock)
int my_b_flush_io_cache(IO_CACHE *info,
int need_append_buffer_lock __attribute__((unused)))
{
size_t length;
my_bool append_cache;
my_off_t pos_in_file;
my_bool append_cache= (info->type == SEQ_READ_APPEND);
DBUG_ENTER("my_b_flush_io_cache");
DBUG_PRINT("enter", ("cache: 0x%lx", (long) info));
if (!(append_cache = (info->type == SEQ_READ_APPEND)))
need_append_buffer_lock=0;
#ifdef THREAD
if (!append_cache)
need_append_buffer_lock= 0;
#endif
if (info->type == WRITE_CACHE || append_cache)
{

View file

@ -16,6 +16,7 @@
#include "mysys_priv.h"
#include <my_dir.h> /* for stat */
#include <m_string.h>
#include "mysys_err.h"
#if defined(HAVE_UTIME_H)
#include <utime.h>
#elif defined(HAVE_SYS_UTIME_H)
@ -56,7 +57,6 @@ int my_copy(const char *from, const char *to, myf MyFlags)
File from_file,to_file;
uchar buff[IO_SIZE];
MY_STAT stat_buff,new_stat_buff;
int res;
DBUG_ENTER("my_copy");
DBUG_PRINT("my",("from %s to %s MyFlags %d", from, to, MyFlags));
@ -102,9 +102,23 @@ int my_copy(const char *from, const char *to, myf MyFlags)
if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat)
DBUG_RETURN(0); /* File copyed but not stat */
res= chmod(to, stat_buff.st_mode & 07777); /* Copy modes */
/* Copy modes */
if (chmod(to, stat_buff.st_mode & 07777))
{
my_errno= errno;
if (MyFlags & (MY_FAE+MY_WME))
my_error(EE_CHANGE_PERMISSIONS, MYF(ME_BELL+ME_WAITTANG), from, errno);
goto err;
}
#if !defined(__WIN__)
res= chown(to, stat_buff.st_uid,stat_buff.st_gid); /* Copy ownership */
/* Copy ownership */
if (chown(to, stat_buff.st_uid, stat_buff.st_gid))
{
my_errno= errno;
if (MyFlags & (MY_FAE+MY_WME))
my_error(EE_CHANGE_OWNERSHIP, MYF(ME_BELL+ME_WAITTANG), from, errno);
goto err;
}
#endif
if (MyFlags & MY_COPYTIME)

View file

@ -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)