~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/log.cc

  • Committer: Brian Aker
  • Date: 2008-12-02 16:33:43 UTC
  • mfrom: (632.1.19 devel)
  • Revision ID: brian@tangent.org-20081202163343-007ifg17p0lvjga7
Merge from Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
};
69
69
 
70
70
 
71
 
char *make_default_log_name(char *buff,const char* log_ext)
 
71
char *make_default_log_name(char *buff,const char *log_ext)
72
72
{
73
 
  strmake(buff, pidfile_name, FN_REFLEN-5);
 
73
  strncpy(buff, pidfile_name, FN_REFLEN-5);
74
74
  return fn_format(buff, buff, drizzle_data_home, log_ext,
75
75
                   MYF(MY_UNPACK_FILENAME|MY_REPLACE_EXT));
76
76
}
868
868
  if ((file= my_open(log_file_name, open_flags,
869
869
                     MYF(MY_WME | ME_WAITTANG))) < 0 ||
870
870
      init_io_cache(&log_file, file, IO_SIZE, io_cache_type,
871
 
                    my_tell(file, MYF(MY_WME)), 0,
 
871
                    my_tell(file), 0,
872
872
                    MYF(MY_WME | MY_NABP |
873
873
                        ((log_type == LOG_BIN) ? MY_WAIT_IF_FULL : 0))))
874
874
    goto err;
1015
1015
{
1016
1016
  if (!log_name || !log_name[0])
1017
1017
  {
1018
 
    strmake(buff, pidfile_name, FN_REFLEN - strlen(suffix) - 1);
 
1018
    strncpy(buff, pidfile_name, FN_REFLEN - strlen(suffix) - 1);
1019
1019
    return (const char *)
1020
1020
      fn_format(buff, buff, "", suffix, MYF(MY_REPLACE_EXT|MY_REPLACE_DIR));
1021
1021
  }
1023
1023
  if (strip_ext)
1024
1024
  {
1025
1025
    char *p= fn_ext(log_name);
1026
 
    uint32_t length= (uint) (p - log_name);
1027
 
    strmake(buff, log_name, cmin(length, (uint)FN_REFLEN));
 
1026
    uint32_t length= cmin((uint32_t)(p - log_name), FN_REFLEN);
 
1027
    strncpy(buff, log_name, length);
 
1028
    buff[length]= '\0';
1028
1029
    return (const char*)buff;
1029
1030
  }
1030
1031
  return log_name;
1286
1287
 
1287
1288
int DRIZZLE_BIN_LOG::raw_get_current_log(LOG_INFO* linfo)
1288
1289
{
1289
 
  strmake(linfo->log_file_name, log_file_name, sizeof(linfo->log_file_name)-1);
 
1290
  strncpy(linfo->log_file_name, log_file_name, sizeof(linfo->log_file_name)-1);
1290
1291
  linfo->pos = my_b_tell(&log_file);
1291
1292
  return 0;
1292
1293
}
1975
1976
  if (dir_len >= FN_REFLEN)
1976
1977
    dir_len=FN_REFLEN-1;
1977
1978
  my_stpncpy(buf, log_file_name, dir_len);
1978
 
  strmake(buf+dir_len, log_ident, FN_REFLEN - dir_len -1);
 
1979
  strncpy(buf+dir_len, log_ident, FN_REFLEN - dir_len -1);
1979
1980
}
1980
1981
 
1981
1982
 
3051
3052
  if (opt_error_log)
3052
3053
  {
3053
3054
    char err_renamed[FN_REFLEN], *end;
3054
 
    end= strmake(err_renamed,log_error_file,FN_REFLEN-4);
 
3055
    end= strncpy(err_renamed,log_error_file,FN_REFLEN-4);
 
3056
    end+= strlen(err_renamed);
3055
3057
    my_stpcpy(end, "-old");
3056
3058
    pthread_mutex_lock(&LOCK_error_log);
3057
3059
    char err_temp[FN_REFLEN+4];
3694
3696
 
3695
3697
    do
3696
3698
    {
3697
 
      strmake(log_name, log_info.log_file_name, sizeof(log_name)-1);
 
3699
      strncpy(log_name, log_info.log_file_name, sizeof(log_name)-1);
3698
3700
    } while (!(error= find_next_log(&log_info, 1)));
3699
3701
 
3700
3702
    if (error !=  LOG_INFO_EOF)