summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2009-11-07 12:34:19 +0200
committerMichael Widenius <monty@askmonty.org>2009-11-07 12:34:19 +0200
commit166e0683c0d45a79716d8913ec9ecaf3177343fa (patch)
tree160b78d78c43f2145e86b2da47c36f11d3cf1525 /mysys
parent9b7a0fddbea952372adc04b1c098411b19cb173b (diff)
downloadmariadb-git-166e0683c0d45a79716d8913ec9ecaf3177343fa.tar.gz
Added error handling for my_seek() & my_tell() failures
mysys/my_seek.c: Give error if MY_WME is used sql/sql_insert.cc: Fixed compiler warning storage/maria/ha_maria.cc: Changed driver of Maria storage engine project
Diffstat (limited to 'mysys')
-rw-r--r--mysys/errors.c2
-rw-r--r--mysys/my_seek.c16
2 files changed, 13 insertions, 5 deletions
diff --git a/mysys/errors.c b/mysys/errors.c
index 7c80fc0f89f..fc63ac9d936 100644
--- a/mysys/errors.c
+++ b/mysys/errors.c
@@ -51,6 +51,7 @@ const char * NEAR globerrs[GLOBERRS]=
"File '%s' not found (Errcode: %d)",
"File '%s' (fileno: %d) was not closed",
"Can't change mode for file '%s' to 0x%lx (Error: %d)",
+ "Can't do seek on file '%s' (Errcode: %d)",
"Warning: Can't copy ownership for file '%s' (Error: %d)"
};
@@ -93,6 +94,7 @@ void init_glob_errs()
EE(EE_FILENOTFOUND) = "File '%s' not found (Errcode: %d)";
EE(EE_FILE_NOT_CLOSED) = "File '%s' (fileno: %d) was not closed";
EE(EE_CANT_CHMOD) = "Can't change mode for file '%s' to 0x%lx (Error: %d)";
+ EE(EE_CANT_SEEK) = "Can't do seek on file '%s' (Errcode: %d)";
EE(EE_CANT_COPY_OWNERSHIP)= "Warning: Can't copy ownership for file '%s' (Error: %d)";
}
#endif
diff --git a/mysys/my_seek.c b/mysys/my_seek.c
index 4e18b510a1e..4ca5393e640 100644
--- a/mysys/my_seek.c
+++ b/mysys/my_seek.c
@@ -14,6 +14,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "mysys_priv.h"
+#include "mysys_err.h"
/*
Seek to a position in a file.
@@ -42,8 +43,7 @@
actual error.
*/
-my_off_t my_seek(File fd, my_off_t pos, int whence,
- myf MyFlags __attribute__((unused)))
+my_off_t my_seek(File fd, my_off_t pos, int whence, myf MyFlags)
{
reg1 os_off_t newpos= -1;
DBUG_ENTER("my_seek");
@@ -68,7 +68,9 @@ my_off_t my_seek(File fd, my_off_t pos, int whence,
newpos= lseek(fd, pos, whence);
if (newpos == (os_off_t) -1)
{
- my_errno=errno;
+ my_errno= errno;
+ if (MyFlags & MY_WME)
+ my_error(EE_CANT_SEEK, MYF(0), my_filename(fd), my_errno);
DBUG_PRINT("error",("lseek: %lu errno: %d", (ulong) newpos,errno));
DBUG_RETURN(MY_FILEPOS_ERROR);
}
@@ -83,7 +85,7 @@ my_off_t my_seek(File fd, my_off_t pos, int whence,
/* Tell current position of file */
/* ARGSUSED */
-my_off_t my_tell(File fd, myf MyFlags __attribute__((unused)))
+my_off_t my_tell(File fd, myf MyFlags)
{
os_off_t pos;
DBUG_ENTER("my_tell");
@@ -95,7 +97,11 @@ my_off_t my_tell(File fd, myf MyFlags __attribute__((unused)))
pos=lseek(fd, 0L, MY_SEEK_CUR);
#endif
if (pos == (os_off_t) -1)
- my_errno=errno;
+ {
+ my_errno= errno;
+ if (MyFlags & MY_WME)
+ my_error(EE_CANT_SEEK, MYF(0), my_filename(fd), my_errno);
+ }
DBUG_PRINT("exit",("pos: %lu", (ulong) pos));
DBUG_RETURN((my_off_t) pos);
} /* my_tell */