summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-03-05 15:50:32 +0100
committerSergei Golubchik <serg@mariadb.org>2017-03-10 18:21:26 +0100
commit6cddd12ad6eeea82b1087574e5dd5cb9accd7641 (patch)
tree5b3ac96d47d06c4345b19383c12e0c54bcdd2fc6 /mysys
parent2b1bbac5fa881b8e135dbad3e0ff6b9e2763e24d (diff)
downloadmariadb-git-6cddd12ad6eeea82b1087574e5dd5cb9accd7641.tar.gz
make sql_udf.cc to shorten dlerror() messages
just as sql_plugin.cc does
Diffstat (limited to 'mysys')
-rw-r--r--mysys/CMakeLists.txt2
-rw-r--r--mysys/my_dlerror.c31
2 files changed, 32 insertions, 1 deletions
diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt
index 3cd243f9f14..eb7f75ed6a8 100644
--- a/mysys/CMakeLists.txt
+++ b/mysys/CMakeLists.txt
@@ -41,7 +41,7 @@ SET(MYSYS_SOURCES array.c charset-def.c charset.c checksum.c my_default.c
my_atomic.c my_getncpus.c my_safehash.c my_chmod.c my_rnd.c
my_uuid.c wqueue.c waiting_threads.c ma_dyncol.c
my_rdtsc.c my_context.c psi_noop.c
- file_logger.c)
+ file_logger.c my_dlerror.c)
IF (WIN32)
SET (MYSYS_SOURCES ${MYSYS_SOURCES} my_winthread.c my_wincond.c my_winerr.c my_winfile.c my_windac.c my_conio.c)
diff --git a/mysys/my_dlerror.c b/mysys/my_dlerror.c
new file mode 100644
index 00000000000..db21b7fc274
--- /dev/null
+++ b/mysys/my_dlerror.c
@@ -0,0 +1,31 @@
+/*
+ Copyright (c) 2017, MariaDB
+
+ 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ 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 */
+
+#include <my_global.h>
+#include <string.h>
+
+const char *my_dlerror(const char *dlpath)
+{
+ const char *errmsg=dlerror();
+ size_t dlpathlen= strlen(dlpath);
+ if (!strncmp(dlpath, errmsg, dlpathlen))
+ { /* if errmsg starts from dlpath, trim this prefix */
+ errmsg+=dlpathlen;
+ if (*errmsg == ':') errmsg++;
+ if (*errmsg == ' ') errmsg++;
+ }
+ return errmsg;
+}