summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-11-26 13:04:36 +0100
committerSergei Golubchik <serg@mariadb.org>2016-12-12 20:27:29 +0100
commit46ae210422c58963786e26af94152e591bb1a098 (patch)
tree34822b7f43b97b2351ef5448fd101db97949c1a7
parent590d473760433afde9f52cae43850898970805a8 (diff)
downloadmariadb-git-46ae210422c58963786e26af94152e591bb1a098.tar.gz
cleanup: my_strerror
-rw-r--r--include/my_sys.h2
-rw-r--r--storage/innobase/handler/ha_innodb.cc12
-rw-r--r--strings/my_vsnprintf.c5
3 files changed, 9 insertions, 10 deletions
diff --git a/include/my_sys.h b/include/my_sys.h
index 528950f4e22..a5ad8f0c057 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -698,7 +698,7 @@ extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags);
extern FILE *my_freopen(const char *path, const char *mode, FILE *stream);
extern int my_fclose(FILE *fd,myf MyFlags);
extern int my_vfprintf(FILE *stream, const char* format, va_list args);
-extern void my_strerror(char *buf, size_t len, int nr);
+extern const char* my_strerror(char *buf, size_t len, int nr);
extern int my_fprintf(FILE *stream, const char* format, ...);
extern File my_fileno(FILE *fd);
extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags);
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 234a8447504..2de0104fea6 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -2619,11 +2619,10 @@ innobase_mysql_tmpfile(
char errbuf[MYSYS_STRERROR_SIZE];
DBUG_PRINT("error",("Got error %d on dup",fd2));
set_my_errno(errno);
- my_strerror(errbuf, sizeof(errbuf), my_errno);
my_error(EE_OUT_OF_FILERESOURCES,
MYF(0),
- "ib*", my_errno,
- errbuf);
+ "ib*", errno,
+ my_strerror(errbuf, sizeof(errbuf), errno));
}
my_close(fd, MYF(MY_WME));
}
@@ -16092,8 +16091,7 @@ ha_innobase::info_low(
char errbuf[MYSYS_STRERROR_SIZE];
thd = ha_thd();
- my_strerror(errbuf, sizeof(errbuf),
- errno);
+
push_warning_printf(
thd,
Sql_condition::WARN_LEVEL_WARN,
@@ -16105,8 +16103,8 @@ ha_innobase::info_low(
" the free space to zero."
" (errno: %d - %s)",
ib_table->name.m_name, errno,
- errbuf);
-
+ my_strerror(errbuf, sizeof(errbuf),
+ errno));
stats.delete_length = 0;
} else {
diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c
index ad270bd9b64..b2ff1e0fa2c 100644
--- a/strings/my_vsnprintf.c
+++ b/strings/my_vsnprintf.c
@@ -790,7 +790,7 @@ int my_fprintf(FILE *stream, const char* format, ...)
@param nr Error number
*/
-void my_strerror(char *buf, size_t len, int nr)
+const char* my_strerror(char *buf, size_t len, int nr)
{
char *msg= NULL;
@@ -802,7 +802,7 @@ void my_strerror(char *buf, size_t len, int nr)
"Internal error/check (Not system error)" :
"Internal error < 0 (Not system error)"),
len-1);
- return;
+ return buf;
}
/*
@@ -843,4 +843,5 @@ void my_strerror(char *buf, size_t len, int nr)
*/
if (!buf[0])
strmake(buf, "unknown error", len - 1);
+ return buf;
}