diff options
author | Seppo Jaakola <seppo.jaakola@codership.com> | 2013-05-24 15:29:01 +0300 |
---|---|---|
committer | Seppo Jaakola <seppo.jaakola@codership.com> | 2013-05-24 15:29:01 +0300 |
commit | 48af4be62a077f5edfadc9b5ea4f6c8c4b00c469 (patch) | |
tree | 18ed52e4c23fdea08f654e611ddd30ee760c1377 /mysys | |
parent | e95fdb74ab85bf24b805c1d4ead8c3d3a791b79a (diff) | |
parent | 421c885446ddf7a996cecb0d3831f7b1a10d3701 (diff) | |
download | mariadb-git-48af4be62a077f5edfadc9b5ea4f6c8c4b00c469.tar.gz |
References: MDEV-4572 - merge with mariaDB 5.5.30
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/errors.c | 6 | ||||
-rw-r--r-- | mysys/mf_pack.c | 11 | ||||
-rw-r--r-- | mysys/my_lib.c | 10 | ||||
-rw-r--r-- | mysys/my_write.c | 16 | ||||
-rw-r--r-- | mysys/thr_rwlock.c | 2 |
5 files changed, 27 insertions, 18 deletions
diff --git a/mysys/errors.c b/mysys/errors.c index bf7299ce4c6..1063cae8856 100644 --- a/mysys/errors.c +++ b/mysys/errors.c @@ -53,7 +53,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)" + "Can't seek in file '%s' (Errcode: %d)", "Can't change mode for file '%s' to 0x%lx (Error: %d)", "Warning: Can't copy ownership for file '%s' (Error: %d)" }; @@ -107,12 +107,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 b42a3d55d93..71969f23d85 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"); @@ -197,10 +198,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 c4cba7a927d..4997a4a804a 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; |