14
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
15
15
16
16
#include "mysys_priv.h"
17
+ #include "mysys_err.h"
17
18
18
19
/*
19
20
Seek to a position in a file.
42
43
actual error.
43
44
*/
44
45
45
- my_off_t my_seek (File fd , my_off_t pos , int whence ,
46
- myf MyFlags __attribute__((unused )))
46
+ my_off_t my_seek (File fd , my_off_t pos , int whence , myf MyFlags )
47
47
{
48
48
os_off_t newpos = -1 ;
49
49
DBUG_ENTER ("my_seek" );
@@ -63,7 +63,9 @@ my_off_t my_seek(File fd, my_off_t pos, int whence,
63
63
if (newpos == (os_off_t ) - 1 )
64
64
{
65
65
my_errno = errno ;
66
- DBUG_PRINT ("error" ,("lseek: %llu errno: %d" , (ulonglong ) newpos ,errno ));
66
+ if (MyFlags & MY_WME )
67
+ my_error (EE_CANT_SEEK , MYF (0 ), my_filename (fd ), my_errno );
68
+ DBUG_PRINT ("error" , ("lseek: %llu errno: %d" , (ulonglong ) newpos , errno ));
67
69
DBUG_RETURN (MY_FILEPOS_ERROR );
68
70
}
69
71
if ((my_off_t ) newpos != pos )
@@ -77,7 +79,7 @@ my_off_t my_seek(File fd, my_off_t pos, int whence,
77
79
/* Tell current position of file */
78
80
/* ARGSUSED */
79
81
80
- my_off_t my_tell (File fd , myf MyFlags __attribute__(( unused )) )
82
+ my_off_t my_tell (File fd , myf MyFlags )
81
83
{
82
84
os_off_t pos ;
83
85
DBUG_ENTER ("my_tell" );
@@ -89,7 +91,12 @@ my_off_t my_tell(File fd, myf MyFlags __attribute__((unused)))
89
91
pos = my_seek (fd , 0L , MY_SEEK_CUR ,0 );
90
92
#endif
91
93
if (pos == (os_off_t ) - 1 )
94
+ {
92
95
my_errno = errno ;
96
+ if (MyFlags & MY_WME )
97
+ my_error (EE_CANT_SEEK , MYF (0 ), my_filename (fd ), my_errno );
98
+ DBUG_PRINT ("error" , ("tell: %llu errno: %d" , (ulonglong ) pos , my_errno ));
99
+ }
93
100
DBUG_PRINT ("exit" ,("pos: %llu" , (ulonglong ) pos ));
94
101
DBUG_RETURN ((my_off_t ) pos );
95
102
} /* my_tell */
0 commit comments