diff options
author | gbichot@production.mysql.com <> | 2005-07-04 22:27:16 +0200 |
---|---|---|
committer | gbichot@production.mysql.com <> | 2005-07-04 22:27:16 +0200 |
commit | 9cfdf2861a55c94a420380630d47e8ab8119cc82 (patch) | |
tree | baf0c231ae2622de89fc8f58bf7dbb40271dadc6 /mysys/my_copy.c | |
parent | d42a35935d5b54065e76de272c346b285a9ec798 (diff) | |
download | mariadb-git-9cfdf2861a55c94a420380630d47e8ab8119cc82.tar.gz |
Making rpl_until more robust if machine is slow. Removing rpl_trunc_binlog
which is wrong now that slave recovers gracefully from a crashed binlog (thx Serg).
stat -> my_stat in my_copy.c so that failing stat() does not hang client connection.
Diffstat (limited to 'mysys/my_copy.c')
-rw-r--r-- | mysys/my_copy.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/mysys/my_copy.c b/mysys/my_copy.c index 03f3feb54d3..072492172e3 100644 --- a/mysys/my_copy.c +++ b/mysys/my_copy.c @@ -16,7 +16,7 @@ #define USES_TYPES /* sys/types is included */ #include "mysys_priv.h" -#include <sys/stat.h> +#include <my_dir.h> /* for stat */ #include <m_string.h> #if defined(HAVE_UTIME_H) #include <utime.h> @@ -53,26 +53,28 @@ struct utimbuf { int my_copy(const char *from, const char *to, myf MyFlags) { uint Count; - int new_file_stat, create_flag; + my_bool new_file_stat; /* 1 if we could stat "to" */ + int create_flag; File from_file,to_file; char buff[IO_SIZE]; - struct stat stat_buff,new_stat_buff; + MY_STAT stat_buff,new_stat_buff; DBUG_ENTER("my_copy"); DBUG_PRINT("my",("from %s to %s MyFlags %d", from, to, MyFlags)); from_file=to_file= -1; - new_file_stat=0; + LINT_INIT(new_file_stat); + DBUG_ASSERT(!(MyFlags & (MY_FNABP | MY_NABP))); /* for my_read/my_write */ if (MyFlags & MY_HOLD_ORIGINAL_MODES) /* Copy stat if possible */ - new_file_stat=stat((char*) to, &new_stat_buff); + new_file_stat= test(my_stat((char*) to, &new_stat_buff, MYF(0))); if ((from_file=my_open(from,O_RDONLY | O_SHARE,MyFlags)) >= 0) { - if (stat(from,&stat_buff)) + if (!my_stat(from, &stat_buff, MyFlags)) { my_errno=errno; goto err; } - if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat) + if (MyFlags & MY_HOLD_ORIGINAL_MODES && new_file_stat) stat_buff=new_stat_buff; create_flag= (MyFlags & MY_DONT_OVERWRITE_FILE) ? O_EXCL : O_TRUNC; @@ -91,7 +93,7 @@ int my_copy(const char *from, const char *to, myf MyFlags) /* Copy modes if possible */ - if (MyFlags & MY_HOLD_ORIGINAL_MODES && new_file_stat) + if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat) DBUG_RETURN(0); /* File copyed but not stat */ VOID(chmod(to, stat_buff.st_mode & 07777)); /* Copy modes */ #if !defined(MSDOS) && !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) && !defined(__NETWARE__) |