Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
b4327ae5
Commit
b4327ae5
authored
Jun 10, 2016
by
Salvatore Sanfilippo
Committed by
GitHub
Jun 10, 2016
Browse files
Merge pull request #3294 from yossigo/fix_unload
Fix MODULE UNLOAD crash and/or wrong error message.
parents
a1684ff1
87312ff7
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/module.c
View file @
b4327ae5
...
@@ -2956,13 +2956,13 @@ int moduleLoad(const char *path) {
...
@@ -2956,13 +2956,13 @@ int moduleLoad(const char *path) {
int
moduleUnload
(
sds
name
)
{
int
moduleUnload
(
sds
name
)
{
struct
RedisModule
*
module
=
dictFetchValue
(
modules
,
name
);
struct
RedisModule
*
module
=
dictFetchValue
(
modules
,
name
);
if
(
listLength
(
module
->
types
)
)
{
if
(
module
==
NULL
)
{
errno
=
E
BUSY
;
errno
=
E
NOENT
;
return
REDISMODULE_ERR
;
return
REDISMODULE_ERR
;
}
}
if
(
module
==
NULL
)
{
if
(
listLength
(
module
->
types
)
)
{
errno
=
E
NOENT
;
errno
=
E
BUSY
;
return
REDISMODULE_ERR
;
return
REDISMODULE_ERR
;
}
}
...
@@ -3020,10 +3020,17 @@ void moduleCommand(client *c) {
...
@@ -3020,10 +3020,17 @@ void moduleCommand(client *c) {
if
(
moduleUnload
(
c
->
argv
[
2
]
->
ptr
)
==
C_OK
)
if
(
moduleUnload
(
c
->
argv
[
2
]
->
ptr
)
==
C_OK
)
addReply
(
c
,
shared
.
ok
);
addReply
(
c
,
shared
.
ok
);
else
{
else
{
char
*
errmsg
=
"operation not possible."
;
char
*
errmsg
;
switch
(
errno
)
{
switch
(
errno
)
{
case
ENOENT
:
errmsg
=
"no such module with that name"
;
case
ENOENT
:
case
EBUSY
:
errmsg
=
"the module exports one or more module-side data types, can't unload"
;
errmsg
=
"no such module with that name"
;
break
;
case
EBUSY
:
errmsg
=
"the module exports one or more module-side data types, can't unload"
;
break
;
default:
errmsg
=
"operation not possible."
;
break
;
}
}
addReplyErrorFormat
(
c
,
"Error unloading module: %s"
,
errmsg
);
addReplyErrorFormat
(
c
,
"Error unloading module: %s"
,
errmsg
);
}
}
...
...
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