diff options
author | Ramil Kalimullin <ramil@mysql.com> | 2010-12-09 12:59:12 +0300 |
---|---|---|
committer | Ramil Kalimullin <ramil@mysql.com> | 2010-12-09 12:59:12 +0300 |
commit | 0137e02899949d714723c537ed23b51e7f5b1a75 (patch) | |
tree | afa353259bdf6aa7951d57c746491dee1af40052 /mysys/my_seek.c | |
parent | 3cecccffaf6690536de46734dfd37086e298a916 (diff) | |
download | mariadb-git-0137e02899949d714723c537ed23b51e7f5b1a75.tar.gz |
Fix for bug#48451: my_seek and my_tell ignore MY_WME flag
my_seek() and my_tell() functions now honour MY_WME flag.
include/mysys_err.h:
Fix for bug#48451: my_seek and my_tell ignore MY_WME flag
- EE_CANT_SEEK added, used in my_seek() and my_tell() functions.
mysys/errors.c:
Fix for bug#48451: my_seek and my_tell ignore MY_WME flag
- EE_CANT_SEEK added, used in my_seek() and my_tell() functions.
mysys/my_seek.c:
Fix for bug#48451: my_seek and my_tell ignore MY_WME flag
- my_seek() and my_tell() handle MY_WME flag.
mysys/my_symlink.c:
Fix for bug#48451: my_seek and my_tell ignore MY_WME flag
- __attribute__((unused)) removed, as myf MyFlags is
actually used in the my_realpath() function.
storage/myisam/ha_myisam.cc:
Fix for bug#48451: my_seek and my_tell ignore MY_WME flag
- check my_seek() result.
Diffstat (limited to 'mysys/my_seek.c')
-rw-r--r-- | mysys/my_seek.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/mysys/my_seek.c b/mysys/my_seek.c index 2c661baeff7..830c2ba245d 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"); @@ -69,6 +69,8 @@ my_off_t my_seek(File fd, my_off_t pos, int whence, if (newpos == (os_off_t) -1) { 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,12 @@ 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; + if (MyFlags & MY_WME) + my_error(EE_CANT_SEEK, MYF(0), my_filename(fd), my_errno); + DBUG_PRINT("error", ("tell: %lu errno: %d", (ulong) pos, my_errno)); + } DBUG_PRINT("exit",("pos: %lu", (ulong) pos)); DBUG_RETURN((my_off_t) pos); } /* my_tell */ |