Commit 09b2dc89 authored by serg@serg.mylan's avatar serg@serg.mylan

manually merged

parents 4915d196 ea6b5e11
...@@ -2036,6 +2036,7 @@ bool flush_error_log() ...@@ -2036,6 +2036,7 @@ bool flush_error_log()
char err_renamed[FN_REFLEN], *end; char err_renamed[FN_REFLEN], *end;
end= strmake(err_renamed,log_error_file,FN_REFLEN-4); end= strmake(err_renamed,log_error_file,FN_REFLEN-4);
strmov(end, "-old"); strmov(end, "-old");
VOID(pthread_mutex_lock(&LOCK_error_log));
#ifdef __WIN__ #ifdef __WIN__
char err_temp[FN_REFLEN+4]; char err_temp[FN_REFLEN+4];
/* /*
...@@ -2043,7 +2044,7 @@ bool flush_error_log() ...@@ -2043,7 +2044,7 @@ bool flush_error_log()
the current error file. the current error file.
*/ */
strmov(strmov(err_temp, err_renamed),"-tmp"); strmov(strmov(err_temp, err_renamed),"-tmp");
(void) my_delete(err_temp, MYF(0)); (void) my_delete(err_temp, MYF(0));
if (freopen(err_temp,"a+",stdout)) if (freopen(err_temp,"a+",stdout))
{ {
freopen(err_temp,"a+",stderr); freopen(err_temp,"a+",stderr);
...@@ -2056,20 +2057,21 @@ bool flush_error_log() ...@@ -2056,20 +2057,21 @@ bool flush_error_log()
if ((fd = my_open(err_temp, O_RDONLY, MYF(0))) >= 0) if ((fd = my_open(err_temp, O_RDONLY, MYF(0))) >= 0)
{ {
while ((bytes = (int) my_read(fd, (byte*) buf, IO_SIZE, MYF(0))) > 0) while ((bytes = (int) my_read(fd, (byte*) buf, IO_SIZE, MYF(0))) > 0)
my_fwrite(stderr, (byte*) buf, (uint) strlen(buf),MYF(0)); my_fwrite(stderr, (byte*) buf, bytes, MYF(0));
my_close(fd, MYF(0)); my_close(fd, MYF(0));
} }
(void) my_delete(err_temp, MYF(0)); (void) my_delete(err_temp, MYF(0));
} }
else else
result= 1; result= 1;
#else #else
my_rename(log_error_file,err_renamed,MYF(0)); my_rename(log_error_file,err_renamed,MYF(0));
if (freopen(log_error_file,"a+",stdout)) if (freopen(log_error_file,"a+",stdout))
freopen(log_error_file,"a+",stderr); freopen(log_error_file,"a+",stderr);
else else
result= 1; result= 1;
#endif #endif
VOID(pthread_mutex_unlock(&LOCK_error_log));
} }
return result; return result;
} }
......
...@@ -961,7 +961,7 @@ static File create_file(THD *thd, char *path, sql_exchange *exchange, ...@@ -961,7 +961,7 @@ static File create_file(THD *thd, char *path, sql_exchange *exchange,
return -1; return -1;
} }
/* Create the file world readable */ /* Create the file world readable */
if ((file= my_create(path, 0666, O_WRONLY, MYF(MY_WME))) < 0) if ((file= my_create(path, 0666, O_WRONLY|O_EXCL, MYF(MY_WME))) < 0)
return file; return file;
#ifdef HAVE_FCHMOD #ifdef HAVE_FCHMOD
(void) fchmod(file, 0666); // Because of umask() (void) fchmod(file, 0666); // Because of umask()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment