2220
2220
return(0); // Already set up
2222
trx_data= (binlog_trx_data*) my_malloc(sizeof(binlog_trx_data), MYF(MY_ZEROFILL));
2222
trx_data= (binlog_trx_data*) malloc(sizeof(binlog_trx_data));
2223
memset(trx_data, 0, sizeof(binlog_trx_data));
2223
2224
if (!trx_data ||
2224
2225
open_cached_file(&trx_data->trans_log, drizzle_tmpdir,
2225
2226
LOG_PREFIX, binlog_cache_size, MYF(MY_WME)))
3049
3050
bool flush_error_log()
3052
3053
if (opt_error_log)
3054
char err_renamed[FN_REFLEN], *end;
3055
end= strncpy(err_renamed,log_error_file,FN_REFLEN-4);
3056
end+= strlen(err_renamed);
3057
my_stpcpy(end, "-old");
3058
3055
pthread_mutex_lock(&LOCK_error_log);
3059
char err_temp[FN_REFLEN+4];
3061
On Windows is necessary a temporary file for to rename
3062
the current error file.
3064
strxmov(err_temp, err_renamed,"-tmp",NULL);
3065
(void) my_delete(err_temp, MYF(0));
3066
if (freopen(err_temp,"a+",stdout))
3070
unsigned char buf[IO_SIZE];
3072
if(freopen(err_temp,"a+",stderr)==NULL)
3074
(void) my_delete(err_renamed, MYF(0));
3075
my_rename(log_error_file,err_renamed,MYF(0));
3076
if (freopen(log_error_file,"a+",stdout)==NULL)
3079
if(freopen(log_error_file,"a+",stderr)==NULL)
3082
if ((fd = my_open(err_temp, O_RDONLY, MYF(0))) >= 0)
3084
while ((bytes= my_read(fd, buf, IO_SIZE, MYF(0))) &&
3085
bytes != MY_FILE_ERROR)
3086
my_fwrite(stderr, buf, bytes, MYF(0));
3087
my_close(fd, MYF(0));
3089
(void) my_delete(err_temp, MYF(0));
3056
if (freopen(log_error_file,"a+",stdout)==NULL)
3058
if (freopen(log_error_file,"a+",stderr)==NULL)
3093
3060
pthread_mutex_unlock(&LOCK_error_log);
3242
3209
npages=(uint)file_length/tc_log_page_size;
3243
3210
assert(npages >= 3); // to guarantee non-empty pool
3244
if (!(pages=(PAGE *)my_malloc(npages*sizeof(PAGE), MYF(MY_WME|MY_ZEROFILL))))
3211
if (!(pages=(PAGE *)malloc(npages*sizeof(PAGE))))
3213
memset(pages, 0, npages*sizeof(PAGE));
3247
3215
for (pg=pages, i=0; i < npages; i++, pg++)