summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
Diffstat (limited to 'mysys')
-rw-r--r--mysys/errors.c6
-rw-r--r--mysys/mf_pack.c11
-rw-r--r--mysys/my_lib.c10
-rw-r--r--mysys/my_write.c16
-rw-r--r--mysys/thr_rwlock.c2
5 files changed, 27 insertions, 18 deletions
diff --git a/mysys/errors.c b/mysys/errors.c
index 6cc0f083922..ebbdc410901 100644
--- a/mysys/errors.c
+++ b/mysys/errors.c
@@ -54,7 +54,7 @@ const char *globerrs[GLOBERRS]=
"File '%s' (fileno: %d) was not closed",
"Can't change ownership of the file '%s' (Errcode: %M)",
"Can't change permissions of the file '%s' (Errcode: %M)",
- "Can't seek in file '%s' (Errcode: %M)"
+ "Can't seek in file '%s' (Errcode: %M)",
"Can't change mode for file '%s' to 0x%lx (Errcode: %M)",
"Warning: Can't copy ownership for file '%s' (Errcode: %M)"
};
@@ -108,12 +108,12 @@ void init_glob_errs()
void wait_for_free_space(const char *filename, int errors)
{
if (errors == 0)
- my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH),
+ my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH | ME_JUST_WARNING),
filename,my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC);
if (!(errors % MY_WAIT_GIVE_USER_A_MESSAGE))
my_printf_error(EE_DISK_FULL,
"Retry in %d secs. Message reprinted in %d secs",
- MYF(ME_BELL | ME_NOREFRESH),
+ MYF(ME_BELL | ME_NOREFRESH | ME_JUST_WARNING),
MY_WAIT_FOR_USER_TO_FIX_PANIC,
MY_WAIT_GIVE_USER_A_MESSAGE * MY_WAIT_FOR_USER_TO_FIX_PANIC );
(void) sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC);
diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c
index a51d94f8e73..d684be238e6 100644
--- a/mysys/mf_pack.c
+++ b/mysys/mf_pack.c
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2012, Monty Program Ab
+/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
+ Copyright (c) 2012, 2013, Monty Program Ab.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -12,7 +12,8 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
#include "mysys_priv.h"
#include <m_string.h>
@@ -452,10 +453,10 @@ char *intern_filename(char *to, const char *from)
char buff[FN_REFLEN + 1];
if (from == to)
{ /* Dirname may destroy from */
- strmov(buff,from);
+ (void) strnmov(buff, from, FN_REFLEN);
from=buff;
}
length= dirname_part(to, from, &to_length); /* Copy dirname & fix chars */
- (void) strmov(to + to_length,from+length);
+ (void) strnmov(to + to_length, from + length, FN_REFLEN - to_length);
return (to);
} /* intern_filename */
diff --git a/mysys/my_lib.c b/mysys/my_lib.c
index 9c8655338c1..f11ea97d328 100644
--- a/mysys/my_lib.c
+++ b/mysys/my_lib.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -11,7 +11,8 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
/* TODO: check for overun of memory for names. */
@@ -96,7 +97,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
MEM_ROOT *names_storage;
DIR *dirp;
struct dirent *dp;
- char tmp_path[FN_REFLEN+1],*tmp_file;
+ char tmp_path[FN_REFLEN + 2], *tmp_file;
char dirent_tmp[sizeof(struct dirent)+_POSIX_PATH_MAX+1];
DBUG_ENTER("my_dir");
@@ -199,10 +200,11 @@ char * directory_file_name (char * dst, const char *src)
{
/* Process as Unix format: just remove test the final slash. */
char *end;
+ DBUG_ASSERT(strlen(src) < (FN_REFLEN + 1));
if (src[0] == 0)
src= (char*) "."; /* Use empty as current */
- end=strmov(dst, src);
+ end= strnmov(dst, src, FN_REFLEN + 1);
if (end[-1] != FN_LIBCHAR)
{
end[0]=FN_LIBCHAR; /* Add last '/' */
diff --git a/mysys/my_write.c b/mysys/my_write.c
index 204e2e1488d..3c94fab2ec7 100644
--- a/mysys/my_write.c
+++ b/mysys/my_write.c
@@ -47,11 +47,17 @@ size_t my_write(File Filedes, const uchar *Buffer, size_t Count, myf MyFlags)
#else
writtenbytes= write(Filedes, Buffer, Count);
#endif
- DBUG_EXECUTE_IF("simulate_file_write_error",
- {
- errno= ENOSPC;
- writtenbytes= (size_t) -1;
- });
+
+ /**
+ To simulate the write error set the errno = error code
+ and the number pf written bytes to -1.
+ */
+ DBUG_EXECUTE_IF ("simulate_file_write_error",
+ if (!errors) {
+ errno= ENOSPC;
+ writtenbytes= (size_t) -1;
+ });
+
if (writtenbytes == Count)
break;
if (writtenbytes != (size_t) -1)
diff --git a/mysys/thr_rwlock.c b/mysys/thr_rwlock.c
index 17fafecd8fd..dd6c625a286 100644
--- a/mysys/thr_rwlock.c
+++ b/mysys/thr_rwlock.c
@@ -24,7 +24,7 @@
static BOOL have_srwlock= FALSE;
/* Prototypes and function pointers for windows functions */
typedef VOID (WINAPI* srw_func) (PSRWLOCK SRWLock);
-typedef BOOL (WINAPI* srw_bool_func) (PSRWLOCK SRWLock);
+typedef BOOLEAN (WINAPI* srw_bool_func) (PSRWLOCK SRWLock);
static srw_func my_InitializeSRWLock;
static srw_func my_AcquireSRWLockExclusive;