Skip to content

Commit 15fe22f

Browse files
author
Ramil Kalimullin
committed
Manual merge with mysql-5.1-bugteam.
2 parents 4e9fb2c + cc12883 commit 15fe22f

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

include/mysys_err.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ extern const char *globerrs[]; /* my_error_messages is here */
6565
#define EE_FILE_NOT_CLOSED 30
6666
#define EE_CHANGE_OWNERSHIP 31
6767
#define EE_CHANGE_PERMISSIONS 32
68-
#define EE_ERROR_LAST 32 /* Copy last error nr */
68+
#define EE_CANT_SEEK 33
69+
#define EE_ERROR_LAST 33 /* Copy last error nr */
6970
/* Add error numbers before EE_ERROR_LAST and change it accordingly. */
7071

7172
/* exit codes for all MySQL programs */

mysys/errors.c

+2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const char *globerrs[GLOBERRS]=
5252
"File '%s' (fileno: %d) was not closed",
5353
"Can't change ownership of the file '%s' (Errcode: %d)",
5454
"Can't change permissions of the file '%s' (Errcode: %d)",
55+
"Can't seek in file '%s' (Errcode: %d)"
5556
};
5657

5758
void init_glob_errs(void)
@@ -94,6 +95,7 @@ void init_glob_errs()
9495
EE(EE_FILE_NOT_CLOSED) = "File '%s' (fileno: %d) was not closed";
9596
EE(EE_CHANGE_OWNERSHIP) = "Can't change ownership of the file '%s' (Errcode: %d)";
9697
EE(EE_CHANGE_PERMISSIONS) = "Can't change permissions of the file '%s' (Errcode: %d)";
98+
EE(EE_CANT_SEEK) = "Can't seek in file '%s' (Errcode: %d)";
9799
}
98100
#endif
99101

mysys/my_seek.c

+11-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
1515

1616
#include "mysys_priv.h"
17+
#include "mysys_err.h"
1718

1819
/*
1920
Seek to a position in a file.
@@ -42,8 +43,7 @@
4243
actual error.
4344
*/
4445

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)
4747
{
4848
os_off_t newpos= -1;
4949
DBUG_ENTER("my_seek");
@@ -63,7 +63,9 @@ my_off_t my_seek(File fd, my_off_t pos, int whence,
6363
if (newpos == (os_off_t) -1)
6464
{
6565
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));
6769
DBUG_RETURN(MY_FILEPOS_ERROR);
6870
}
6971
if ((my_off_t) newpos != pos)
@@ -77,7 +79,7 @@ my_off_t my_seek(File fd, my_off_t pos, int whence,
7779
/* Tell current position of file */
7880
/* ARGSUSED */
7981

80-
my_off_t my_tell(File fd, myf MyFlags __attribute__((unused)))
82+
my_off_t my_tell(File fd, myf MyFlags)
8183
{
8284
os_off_t pos;
8385
DBUG_ENTER("my_tell");
@@ -89,7 +91,12 @@ my_off_t my_tell(File fd, myf MyFlags __attribute__((unused)))
8991
pos= my_seek(fd, 0L, MY_SEEK_CUR,0);
9092
#endif
9193
if (pos == (os_off_t) -1)
94+
{
9295
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+
}
93100
DBUG_PRINT("exit",("pos: %llu", (ulonglong) pos));
94101
DBUG_RETURN((my_off_t) pos);
95102
} /* my_tell */

mysys/my_symlink.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ int my_is_symlink(const char *filename __attribute__((unused)))
118118
'to' may be equal to 'filename'
119119
*/
120120

121-
int my_realpath(char *to, const char *filename,
122-
myf MyFlags __attribute__((unused)))
121+
int my_realpath(char *to, const char *filename, myf MyFlags)
123122
{
124123
#if defined(HAVE_REALPATH) && !defined(HAVE_BROKEN_REALPATH)
125124
int result=0;

0 commit comments

Comments
 (0)