Skip to content

Commit

Permalink
cleanup: my_strerror
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Dec 12, 2016
1 parent 590d473 commit 46ae210
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion include/my_sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 5 additions & 7 deletions storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down Expand Up @@ -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,
Expand All @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions strings/my_vsnprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
}

/*
Expand Down Expand Up @@ -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;
}

0 comments on commit 46ae210

Please sign in to comment.