Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
6cddd12a
Commit
6cddd12a
authored
Mar 05, 2017
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make sql_udf.cc to shorten dlerror() messages
just as sql_plugin.cc does
parent
2b1bbac5
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
16 deletions
+40
-16
include/my_sys.h
include/my_sys.h
+2
-0
mysys/CMakeLists.txt
mysys/CMakeLists.txt
+1
-1
mysys/my_dlerror.c
mysys/my_dlerror.c
+31
-0
sql/sql_plugin.cc
sql/sql_plugin.cc
+2
-10
sql/sql_udf.cc
sql/sql_udf.cc
+4
-5
No files found.
include/my_sys.h
View file @
6cddd12a
...
@@ -998,6 +998,8 @@ void my_uuid(uchar *guid);
...
@@ -998,6 +998,8 @@ void my_uuid(uchar *guid);
void
my_uuid2str
(
const
uchar
*
guid
,
char
*
s
);
void
my_uuid2str
(
const
uchar
*
guid
,
char
*
s
);
void
my_uuid_end
(
void
);
void
my_uuid_end
(
void
);
const
char
*
my_dlerror
(
const
char
*
dlpath
);
/* character sets */
/* character sets */
extern
void
my_charset_loader_init_mysys
(
MY_CHARSET_LOADER
*
loader
);
extern
void
my_charset_loader_init_mysys
(
MY_CHARSET_LOADER
*
loader
);
extern
uint
get_charset_number
(
const
char
*
cs_name
,
uint
cs_flags
);
extern
uint
get_charset_number
(
const
char
*
cs_name
,
uint
cs_flags
);
...
...
mysys/CMakeLists.txt
View file @
6cddd12a
...
@@ -41,7 +41,7 @@ SET(MYSYS_SOURCES array.c charset-def.c charset.c checksum.c my_default.c
...
@@ -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_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_uuid.c wqueue.c waiting_threads.c ma_dyncol.c
my_rdtsc.c my_context.c psi_noop.c
my_rdtsc.c my_context.c psi_noop.c
file_logger.c
)
file_logger.c
my_dlerror.c
)
IF
(
WIN32
)
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
)
SET
(
MYSYS_SOURCES
${
MYSYS_SOURCES
}
my_winthread.c my_wincond.c my_winerr.c my_winfile.c my_windac.c my_conio.c
)
...
...
mysys/my_dlerror.c
0 → 100644
View file @
6cddd12a
/*
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
;
}
sql/sql_plugin.cc
View file @
6cddd12a
...
@@ -723,7 +723,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
...
@@ -723,7 +723,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
{
{
#ifdef HAVE_DLOPEN
#ifdef HAVE_DLOPEN
char
dlpath
[
FN_REFLEN
];
char
dlpath
[
FN_REFLEN
];
uint
plugin_dir_len
,
dummy_errors
,
dlpathlen
,
i
;
uint
plugin_dir_len
,
dummy_errors
,
i
;
struct
st_plugin_dl
*
tmp
=
0
,
plugin_dl
;
struct
st_plugin_dl
*
tmp
=
0
,
plugin_dl
;
void
*
sym
;
void
*
sym
;
st_ptr_backup
tmp_backup
[
array_elements
(
list_of_services
)];
st_ptr_backup
tmp_backup
[
array_elements
(
list_of_services
)];
...
@@ -759,15 +759,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
...
@@ -759,15 +759,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
/* Open new dll handle */
/* Open new dll handle */
if
(
!
(
plugin_dl
.
handle
=
dlopen
(
dlpath
,
RTLD_NOW
)))
if
(
!
(
plugin_dl
.
handle
=
dlopen
(
dlpath
,
RTLD_NOW
)))
{
{
const
char
*
errmsg
=
dlerror
();
report_error
(
report
,
ER_CANT_OPEN_LIBRARY
,
dlpath
,
errno
,
my_dlerror
(
dlpath
));
dlpathlen
=
strlen
(
dlpath
);
if
(
!
strncmp
(
dlpath
,
errmsg
,
dlpathlen
))
{
// if errmsg starts from dlpath, trim this prefix.
errmsg
+=
dlpathlen
;
if
(
*
errmsg
==
':'
)
errmsg
++
;
if
(
*
errmsg
==
' '
)
errmsg
++
;
}
report_error
(
report
,
ER_CANT_OPEN_LIBRARY
,
dlpath
,
errno
,
errmsg
);
goto
ret
;
goto
ret
;
}
}
dlopen_count
++
;
dlopen_count
++
;
...
...
sql/sql_udf.cc
View file @
6cddd12a
...
@@ -227,14 +227,13 @@ void udf_init()
...
@@ -227,14 +227,13 @@ void udf_init()
if
(
dl
==
NULL
)
if
(
dl
==
NULL
)
{
{
char
dlpath
[
FN_REFLEN
];
char
dlpath
[
FN_REFLEN
];
strxnmov
(
dlpath
,
sizeof
(
dlpath
)
-
1
,
opt_plugin_dir
,
"/"
,
tmp
->
dl
,
strxnmov
(
dlpath
,
sizeof
(
dlpath
)
-
1
,
opt_plugin_dir
,
"/"
,
tmp
->
dl
,
NullS
);
NullS
);
(
void
)
unpack_filename
(
dlpath
,
dlpath
);
(
void
)
unpack_filename
(
dlpath
,
dlpath
);
if
(
!
(
dl
=
dlopen
(
dlpath
,
RTLD_NOW
)))
if
(
!
(
dl
=
dlopen
(
dlpath
,
RTLD_NOW
)))
{
{
/* Print warning to log */
/* Print warning to log */
sql_print_error
(
ER_THD
(
new_thd
,
ER_CANT_OPEN_LIBRARY
),
sql_print_error
(
ER_THD
(
new_thd
,
ER_CANT_OPEN_LIBRARY
),
tmp
->
dl
,
errno
,
dlerror
(
));
tmp
->
dl
,
errno
,
my_dlerror
(
dlpath
));
/* Keep the udf in the hash so that we can remove it later */
/* Keep the udf in the hash so that we can remove it later */
continue
;
continue
;
}
}
...
@@ -538,10 +537,10 @@ int mysql_create_function(THD *thd,udf_func *udf)
...
@@ -538,10 +537,10 @@ int mysql_create_function(THD *thd,udf_func *udf)
if
(
!
(
dl
=
dlopen
(
dlpath
,
RTLD_NOW
)))
if
(
!
(
dl
=
dlopen
(
dlpath
,
RTLD_NOW
)))
{
{
my_error
(
ER_CANT_OPEN_LIBRARY
,
MYF
(
0
),
udf
->
dl
,
errno
,
my_dlerror
(
dlpath
));
DBUG_PRINT
(
"error"
,(
"dlopen of %s failed, error: %d (%s)"
,
DBUG_PRINT
(
"error"
,(
"dlopen of %s failed, error: %d (%s)"
,
udf
->
dl
,
errno
,
dlerror
()));
udf
->
dl
,
errno
,
dlerror
()));
my_error
(
ER_CANT_OPEN_LIBRARY
,
MYF
(
0
),
udf
->
dl
,
errno
,
dlerror
());
goto
err
;
goto
err
;
}
}
new_dl
=
1
;
new_dl
=
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment