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
500e5117
Commit
500e5117
authored
Dec 20, 2018
by
antirez
Browse files
Modules shared API: prevent unloading of used modules.
parent
7854daa1
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/module.c
View file @
500e5117
...
@@ -4902,11 +4902,12 @@ int moduleUnload(sds name) {
...
@@ -4902,11 +4902,12 @@ int moduleUnload(sds name) {
if (module == NULL) {
if (module == NULL) {
errno = ENOENT;
errno = ENOENT;
return REDISMODULE_ERR;
return REDISMODULE_ERR;
}
} else if (listLength(module->types)) {
if (listLength(module->types)) {
errno = EBUSY;
errno = EBUSY;
return REDISMODULE_ERR;
return REDISMODULE_ERR;
} else if (listLength(module->usedby)) {
errno = EPERM;
return REDISMODULE_ERR;
}
}
moduleUnregisterCommands(module);
moduleUnregisterCommands(module);
...
@@ -4972,7 +4973,12 @@ NULL
...
@@ -4972,7 +4973,12 @@ NULL
errmsg = "no such module with that name";
errmsg = "no such module with that name";
break;
break;
case EBUSY:
case EBUSY:
errmsg = "the module exports one or more module-side data types, can't unload";
errmsg = "the module exports one or more module-side data "
"types, can't unload";
break;
case EPERM:
errmsg = "the module exports APIs used by other modules. "
"Please unload them first and try again";
break;
break;
default:
default:
errmsg = "operation not possible.";
errmsg = "operation not possible.";
...
...
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