summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_locking.c15
-rw-r--r--myisam/myisamdef.h3
2 files changed, 18 insertions, 0 deletions
diff --git a/myisam/mi_locking.c b/myisam/mi_locking.c
index 8d48c5242e5..36b793363c5 100644
--- a/myisam/mi_locking.c
+++ b/myisam/mi_locking.c
@@ -224,6 +224,21 @@ int mi_lock_database(MI_INFO *info, int lock_type)
break; /* Impossible */
}
}
+#ifdef __WIN__
+ else
+ {
+ /*
+ Check for bad file descriptors if this table is part
+ of a merge union. Failing to capture this may cause
+ a crash on windows if the table is renamed and
+ later on referenced by the merge table.
+ */
+ if( info->owned_by_merge && (info->s)->kfile < 0 )
+ {
+ error = HA_ERR_NO_SUCH_TABLE;
+ }
+ }
+#endif
pthread_mutex_unlock(&share->intern_lock);
#if defined(FULL_LOG) || defined(_lint)
lock_type|=(int) (flag << 8); /* Set bit to set if real lock */
diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h
index 9e87f51a6be..12e2c8e4bec 100644
--- a/myisam/myisamdef.h
+++ b/myisam/myisamdef.h
@@ -280,6 +280,9 @@ struct st_myisam_info {
my_bool page_changed; /* If info->buff can't be used for rnext */
my_bool buff_used; /* If info->buff has to be reread for rnext */
my_bool once_flags; /* For MYISAMMRG */
+#ifdef __WIN__
+ my_bool owned_by_merge; /* This MyISAM table is part of a merge union */
+#endif
#ifdef THREAD
THR_LOCK_DATA lock;
#endif