summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorRamil Kalimullin <ramil@mysql.com>2010-12-09 13:49:11 +0300
committerRamil Kalimullin <ramil@mysql.com>2010-12-09 13:49:11 +0300
commit15fe22ff9dabb694fbf58a3083c5fb4da02e655a (patch)
tree4f7e3b43c31457eb35f487e3a07132abf8212077 /mysys
parent4e9fb2c76f65e9949ebd3bbe2608f6a3b80a3822 (diff)
parentcc1288349f7af7937d30921d80d761889e88e9b6 (diff)
downloadmariadb-git-15fe22ff9dabb694fbf58a3083c5fb4da02e655a.tar.gz
Manual merge with mysql-5.1-bugteam.
Diffstat (limited to 'mysys')
-rw-r--r--mysys/errors.c2
-rw-r--r--mysys/my_seek.c15
-rw-r--r--mysys/my_symlink.c3
3 files changed, 14 insertions, 6 deletions
diff --git a/mysys/errors.c b/mysys/errors.c
index 8bc310652f1..c74ed292906 100644
--- a/mysys/errors.c
+++ b/mysys/errors.c
@@ -52,6 +52,7 @@ const char *globerrs[GLOBERRS]=
"File '%s' (fileno: %d) was not closed",
"Can't change ownership of the file '%s' (Errcode: %d)",
"Can't change permissions of the file '%s' (Errcode: %d)",
+ "Can't seek in file '%s' (Errcode: %d)"
};
void init_glob_errs(void)
@@ -94,6 +95,7 @@ void init_glob_errs()
EE(EE_FILE_NOT_CLOSED) = "File '%s' (fileno: %d) was not closed";
EE(EE_CHANGE_OWNERSHIP) = "Can't change ownership of the file '%s' (Errcode: %d)";
EE(EE_CHANGE_PERMISSIONS) = "Can't change permissions of the file '%s' (Errcode: %d)";
+ EE(EE_CANT_SEEK) = "Can't seek in file '%s' (Errcode: %d)";
}
#endif
diff --git a/mysys/my_seek.c b/mysys/my_seek.c
index 8502c259353..ca12a2e95d1 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)
{
os_off_t newpos= -1;
DBUG_ENTER("my_seek");
@@ -63,7 +63,9 @@ my_off_t my_seek(File fd, my_off_t pos, int whence,
if (newpos == (os_off_t) -1)
{
my_errno= errno;
- DBUG_PRINT("error",("lseek: %llu errno: %d", (ulonglong) newpos,errno));
+ if (MyFlags & MY_WME)
+ my_error(EE_CANT_SEEK, MYF(0), my_filename(fd), my_errno);
+ DBUG_PRINT("error", ("lseek: %llu errno: %d", (ulonglong) newpos, errno));
DBUG_RETURN(MY_FILEPOS_ERROR);
}
if ((my_off_t) newpos != pos)
@@ -77,7 +79,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");
@@ -89,7 +91,12 @@ my_off_t my_tell(File fd, myf MyFlags __attribute__((unused)))
pos= my_seek(fd, 0L, MY_SEEK_CUR,0);
#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: %llu errno: %d", (ulonglong) pos, my_errno));
+ }
DBUG_PRINT("exit",("pos: %llu", (ulonglong) pos));
DBUG_RETURN((my_off_t) pos);
} /* my_tell */
diff --git a/mysys/my_symlink.c b/mysys/my_symlink.c
index b57edd2179a..59d929f9a61 100644
--- a/mysys/my_symlink.c
+++ b/mysys/my_symlink.c
@@ -118,8 +118,7 @@ int my_is_symlink(const char *filename __attribute__((unused)))
'to' may be equal to 'filename'
*/
-int my_realpath(char *to, const char *filename,
- myf MyFlags __attribute__((unused)))
+int my_realpath(char *to, const char *filename, myf MyFlags)
{
#if defined(HAVE_REALPATH) && !defined(HAVE_BROKEN_REALPATH)
int result=0;