summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2010-05-26 21:55:40 +0300
committerMichael Widenius <monty@askmonty.org>2010-05-26 21:55:40 +0300
commit4aa9d903c11554cc4887eeffe7f0592c52e8bc99 (patch)
treeaf3f0dfb833c3c4aabaa69ce50cfb64202ecd479 /mysys
parent9febcb4776e563a93eb8fff247174b0e2eb2ae0b (diff)
parentaf6d89a6aa9feb3545de068f461cf91bfb281dd2 (diff)
downloadmariadb-git-4aa9d903c11554cc4887eeffe7f0592c52e8bc99.tar.gz
Merge with MySQL 5.1.47
Fixed some bugs introduced in 5.1.47 Disabled some tests until we have merged with latest Xtradb configure.in: Added testing if valgrind/memcheck.h exists storage/pbxt/src/ha_pbxt.cc: LOCK_plugin is not anymore locked in init
Diffstat (limited to 'mysys')
-rw-r--r--mysys/mf_loadpath.c16
-rw-r--r--mysys/my_file.c2
-rw-r--r--mysys/my_getwd.c7
-rw-r--r--mysys/my_symlink.c5
4 files changed, 22 insertions, 8 deletions
diff --git a/mysys/mf_loadpath.c b/mysys/mf_loadpath.c
index 48a69207839..510c72ffa38 100644
--- a/mysys/mf_loadpath.c
+++ b/mysys/mf_loadpath.c
@@ -26,7 +26,8 @@
char * my_load_path(char * to, const char *path,
const char *own_path_prefix)
{
- char buff[FN_REFLEN];
+ char buff[FN_REFLEN+1];
+ const char *from= buff;
int is_cur;
DBUG_ENTER("my_load_path");
DBUG_PRINT("enter",("path: %s prefix: %s",path,
@@ -34,7 +35,7 @@ char * my_load_path(char * to, const char *path,
if ((path[0] == FN_HOMELIB && path[1] == FN_LIBCHAR) ||
test_if_hard_path(path))
- VOID(strmov(buff,path));
+ from= path;
else if ((is_cur=(path[0] == FN_CURLIB && path[1] == FN_LIBCHAR)) ||
(is_prefix(path,FN_PARENTDIR)) ||
! own_path_prefix)
@@ -42,13 +43,16 @@ char * my_load_path(char * to, const char *path,
if (is_cur)
is_cur=2; /* Remove current dir */
if (! my_getwd(buff,(uint) (FN_REFLEN-strlen(path)+is_cur),MYF(0)))
- VOID(strcat(buff,path+is_cur));
+ {
+ size_t length= strlen(buff);
+ (void) strmake(buff + length, path+is_cur, FN_REFLEN - length);
+ }
else
- VOID(strmov(buff,path)); /* Return org file name */
+ from= path; /* Return org file name */
}
else
- VOID(strxmov(buff,own_path_prefix,path,NullS));
- strmov(to,buff);
+ (void) strxnmov(buff, FN_REFLEN, own_path_prefix, path, NullS);
+ strmake(to, from, FN_REFLEN-1);
DBUG_PRINT("exit",("to: %s",to));
DBUG_RETURN(to);
} /* my_load_path */
diff --git a/mysys/my_file.c b/mysys/my_file.c
index 64dc4745703..594f361437f 100644
--- a/mysys/my_file.c
+++ b/mysys/my_file.c
@@ -72,7 +72,7 @@ static uint set_max_open_files(uint max_file_limit)
}
#else
-static int set_max_open_files(uint max_file_limit)
+static uint set_max_open_files(uint max_file_limit)
{
/* We don't know the limit. Return best guess */
return min(max_file_limit, OS_FILE_LIMIT);
diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c
index e0c5b94b53e..e6b867e2753 100644
--- a/mysys/my_getwd.c
+++ b/mysys/my_getwd.c
@@ -50,11 +50,16 @@ int my_getwd(char * buf, size_t size, myf MyFlags)
DBUG_PRINT("my",("buf: 0x%lx size: %u MyFlags %d",
(long) buf, (uint) size, MyFlags));
+ if (size < 1)
+ return(-1);
+
if (curr_dir[0]) /* Current pos is saved here */
VOID(strmake(buf,&curr_dir[0],size-1));
else
{
#if defined(HAVE_GETCWD)
+ if (size < 2)
+ return(-1);
if (!getcwd(buf,(uint) (size-2)) && MyFlags & MY_WME)
{
my_errno=errno;
@@ -68,6 +73,8 @@ int my_getwd(char * buf, size_t size, myf MyFlags)
strmake(buf,pathname,size-1);
}
#elif defined(VMS)
+ if (size < 2)
+ return(-1);
if (!getcwd(buf,size-2,1) && MyFlags & MY_WME)
{
my_errno=errno;
diff --git a/mysys/my_symlink.c b/mysys/my_symlink.c
index 258e227bb7b..33f45a882e1 100644
--- a/mysys/my_symlink.c
+++ b/mysys/my_symlink.c
@@ -117,6 +117,9 @@ int my_is_symlink(const char *filename __attribute__((unused)))
/*
Resolve all symbolic links in path
'to' may be equal to 'filename'
+
+ to is guaranteed to never set to a string longer than FN_REFLEN
+ (including the end \0)
*/
int my_realpath(char *to, const char *filename,
@@ -130,7 +133,7 @@ int my_realpath(char *to, const char *filename,
DBUG_PRINT("info",("executing realpath"));
if ((ptr=realpath(filename,buff)))
- strmake(to,ptr,FN_REFLEN-1);
+ strmake(to, ptr, FN_REFLEN-1);
else
{
/*