~ubuntu-branches/ubuntu/natty/mysql-5.1/natty-proposed

« back to all changes in this revision

Viewing changes to storage/myisam/ha_myisam.cc

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 08:30:45 UTC
  • mfrom: (1.4.1)
  • Revision ID: package-import@ubuntu.com-20120222083045-2rd53r4bnyx7qus4
Tags: 5.1.61-0ubuntu0.11.04.1
* SECURITY UPDATE: Update to 5.1.61 to fix multiple security issues
  (LP: #937869)
  - http://www.oracle.com/technetwork/topics/security/cpujan2012-366304.html
  - CVE-2011-2262
  - CVE-2012-0075
  - CVE-2012-0112
  - CVE-2012-0113
  - CVE-2012-0114
  - CVE-2012-0115
  - CVE-2012-0116
  - CVE-2012-0117
  - CVE-2012-0118
  - CVE-2012-0119
  - CVE-2012-0120
  - CVE-2012-0484
  - CVE-2012-0485
  - CVE-2012-0486
  - CVE-2012-0487
  - CVE-2012-0488
  - CVE-2012-0489
  - CVE-2012-0490
  - CVE-2012-0491
  - CVE-2012-0492
  - CVE-2012-0493
  - CVE-2012-0494
  - CVE-2012-0495
  - CVE-2012-0496

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2000-2006 MySQL AB
 
1
/*
 
2
   Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
2
3
 
3
4
   This program is free software; you can redistribute it and/or modify
4
5
   it under the terms of the GNU General Public License as published by
11
12
 
12
13
   You should have received a copy of the GNU General Public License
13
14
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
 
16
*/
15
17
 
16
18
 
17
19
#ifdef USE_PRAGMA_IMPLEMENTATION
552
554
   can_enable_indexes(1)
553
555
{}
554
556
 
555
 
handler *ha_myisam::clone(MEM_ROOT *mem_root)
 
557
handler *ha_myisam::clone(const char *name, MEM_ROOT *mem_root)
556
558
{
557
 
  ha_myisam *new_handler= static_cast <ha_myisam *>(handler::clone(mem_root));
 
559
  ha_myisam *new_handler= static_cast <ha_myisam *>(handler::clone(name,
 
560
                                                                   mem_root));
558
561
  if (new_handler)
559
562
    new_handler->file->state= file->state;
560
563
  return new_handler;
590
593
  int data_fd = file->dfile;
591
594
  int error = 0;
592
595
 
593
 
  my_seek(data_fd, 0L, MY_SEEK_SET, MYF(MY_WME));
 
596
  if (my_seek(data_fd, 0L, MY_SEEK_SET, MYF(MY_WME)) == MY_FILEPOS_ERROR)
 
597
  {
 
598
    error= my_errno;
 
599
    goto err;
 
600
  }
594
601
  for (;;)
595
602
  {
596
603
    ulong packet_len = my_net_read(net);
626
633
    return ENOMEM;
627
634
 
628
635
  int error = 0;
629
 
  my_seek(data_fd, 0L, MY_SEEK_SET, MYF(MY_WME));
 
636
  if (my_seek(data_fd, 0L, MY_SEEK_SET, MYF(MY_WME)) == MY_FILEPOS_ERROR)
 
637
  {
 
638
    error= my_errno;
 
639
    goto err;
 
640
  }
630
641
  for (; bytes_to_read > 0;)
631
642
  {
632
643
    size_t bytes = my_read(data_fd, buf, blocksize, MYF(MY_WME));
1124
1135
                        mi_get_mask_all_keys_active(share->base.keys) :
1125
1136
                        share->state.key_map);
1126
1137
    uint testflag=param.testflag;
 
1138
#ifdef HAVE_MMAP
 
1139
    bool remap= test(share->file_map);
 
1140
    /*
 
1141
      mi_repair*() functions family use file I/O even if memory
 
1142
      mapping is available.
 
1143
 
 
1144
      Since mixing mmap I/O and file I/O may cause various artifacts,
 
1145
      memory mapping must be disabled.
 
1146
    */
 
1147
    if (remap)
 
1148
      mi_munmap_file(file);
 
1149
#endif
1127
1150
    if (mi_test_if_sort_rep(file,file->state->records,key_map,0) &&
1128
1151
        (local_testflag & T_REP_BY_SORT))
1129
1152
    {
1155
1178
      error=  mi_repair(&param, file, fixed_name,
1156
1179
                        param.testflag & T_QUICK);
1157
1180
    }
 
1181
#ifdef HAVE_MMAP
 
1182
    if (remap)
 
1183
      mi_dynmap_file(file, file->state->data_file_length);
 
1184
#endif
1158
1185
    param.testflag=testflag;
1159
1186
    optimize_done=1;
1160
1187
  }