summaryrefslogtreecommitdiff
path: root/storage/connect/filamvct.cpp
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2013-03-30 22:06:35 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2013-03-30 22:06:35 +0100
commit879be566e084e493415b362e40f616f6b3731f52 (patch)
tree0045173cdaec282c994e1fa3c0aa211c80e88999 /storage/connect/filamvct.cpp
parent98e551d0cfa9c9d73ab5603f956a52bd2e719f5d (diff)
downloadmariadb-git-879be566e084e493415b362e40f616f6b3731f52.tar.gz
- Add some warnings to Create Table process
modified: storage/connect/filamvct.cpp storage/connect/ha_connect.cc
Diffstat (limited to 'storage/connect/filamvct.cpp')
-rw-r--r--storage/connect/filamvct.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/storage/connect/filamvct.cpp b/storage/connect/filamvct.cpp
index 80a5501938f..6a3d0ad0995 100644
--- a/storage/connect/filamvct.cpp
+++ b/storage/connect/filamvct.cpp
@@ -153,9 +153,8 @@ void VCTFAM::Reset(void)
int VCTFAM::GetBlockInfo(PGLOBAL g)
{
char filename[_MAX_PATH];
- int k, n;
+ int h, k, n;
VECHEADER vh;
- FILE *s;
if (Header < 1 || Header > 3 || !MaxBlk) {
sprintf(g->Message, "Invalid header value %d", Header);
@@ -168,15 +167,20 @@ int VCTFAM::GetBlockInfo(PGLOBAL g)
if (Header == 2)
strcat(PlugRemoveType(filename, filename), ".blk");
- if (!(s= global_fopen(g, MSGID_CANNOT_OPEN, filename, "rb"))) {
+ if ((h = global_open(g, MSGID_CANNOT_OPEN, filename, O_RDONLY)) == -1
+ || !_filelength(h)) {
// Consider this is a void table
Last = Nrec;
Block = 0;
+
+ if (h != -1)
+ close(h);
+
return n;
} else if (Header == 3)
- k = fseek(s, -(int)sizeof(VECHEADER), SEEK_END);
+ k = lseek(h, -(int)sizeof(VECHEADER), SEEK_END);
- if (fread(&vh, sizeof(vh), 1, s) != 1) {
+ if ((k = read(h, &vh, sizeof(vh))) != sizeof(vh)) {
sprintf(g->Message, "Error reading header file %s", filename);
n = -1;
} else if (MaxBlk * Nrec != vh.MaxRec) {
@@ -188,7 +192,7 @@ int VCTFAM::GetBlockInfo(PGLOBAL g)
Last = (vh.NumRec + Nrec - 1) % Nrec + 1;
} // endif s
- fclose(s);
+ close(h);
return n;
} // end of GetBlockInfo