summaryrefslogtreecommitdiff
path: root/storage/myisam/myisamchk.c
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-03-11 13:40:31 +0100
committerSergei Golubchik <serg@mariadb.org>2016-12-12 20:27:35 +0100
commit5d6aab809d9c22f0c489fd3e060f7cde5f8264fa (patch)
treea4319c505d06fc90ee3ae82f9c2061494db8d74c /storage/myisam/myisamchk.c
parent961fc6a673ea3691f41f3d1f9eabfac799047fc4 (diff)
downloadmariadb-git-5d6aab809d9c22f0c489fd3e060f7cde5f8264fa.tar.gz
cleanup: minor issues in MyISAM
Diffstat (limited to 'storage/myisam/myisamchk.c')
-rw-r--r--storage/myisam/myisamchk.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c
index c206b562d72..7a4f9960af6 100644
--- a/storage/myisam/myisamchk.c
+++ b/storage/myisam/myisamchk.c
@@ -819,20 +819,22 @@ static int myisamchk(HA_CHECK *param, char * filename)
char llbuff[22],llbuff2[22];
my_bool state_updated=0;
MYISAM_SHARE *share;
+ int open_mode;
+ uint open_flags= HA_OPEN_FOR_REPAIR;
DBUG_ENTER("myisamchk");
param->out_flag=error=param->warning_printed=param->error_printed=
recreate=0;
datafile=0;
param->isam_file_name=filename; /* For error messages */
- if (!(info=mi_open(filename,
- (param->testflag & (T_DESCRIPT | T_READONLY)) ?
- O_RDONLY : O_RDWR,
- HA_OPEN_FOR_REPAIR |
- ((param->testflag & T_WAIT_FOREVER) ?
- HA_OPEN_WAIT_IF_LOCKED :
- (param->testflag & T_DESCRIPT) ?
- HA_OPEN_IGNORE_IF_LOCKED : HA_OPEN_ABORT_IF_LOCKED))))
+ open_mode= param->testflag & (T_DESCRIPT | T_READONLY) ? O_RDONLY : O_RDWR;
+ if (param->testflag & T_WAIT_FOREVER)
+ open_flags|= HA_OPEN_WAIT_IF_LOCKED;
+ else if (param->testflag & T_DESCRIPT)
+ open_flags|= HA_OPEN_IGNORE_IF_LOCKED;
+ else
+ open_flags|= HA_OPEN_ABORT_IF_LOCKED;
+ if (!(info=mi_open(filename, open_mode, open_flags)))
{
/* Avoid twice printing of isam file name */
param->error_printed=1;