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
ebaa9226
Commit
ebaa9226
authored
Oct 30, 2015
by
antirez
Browse files
Scripting: fix error reporting of many Redis provided functions.
parent
2dabf82d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/scripting.c
View file @
ebaa9226
...
...
@@ -487,8 +487,8 @@ int luaRedisSha1hexCommand(lua_State *lua) {
char
*
s
;
if
(
argc
!=
1
)
{
lua
P
ush
Error
(
lua
,
"wrong number of arguments"
);
return
1
;
lua
_p
ush
string
(
lua
,
"wrong number of arguments"
);
return
lua_error
(
lua
)
;
}
s
=
(
char
*
)
lua_tolstring
(
lua
,
1
,
&
len
);
...
...
@@ -556,17 +556,17 @@ int luaRedisSetReplCommand(lua_State *lua) {
int
flags
;
if
(
server
.
lua_replicate_commands
==
0
)
{
lua
P
ush
Error
(
lua
,
"You can set the replication behavior only after turning on single commands replication with redis.replicate_commands()."
);
return
1
;
lua
_p
ush
string
(
lua
,
"You can set the replication behavior only after turning on single commands replication with redis.replicate_commands()."
);
return
lua_error
(
lua
)
;
}
else
if
(
argc
!=
1
)
{
lua
P
ush
Error
(
lua
,
"redis.set_repl() requires two arguments."
);
return
1
;
lua
_p
ush
string
(
lua
,
"redis.set_repl() requires two arguments."
);
return
lua_error
(
lua
)
;
}
flags
=
lua_tonumber
(
lua
,
-
1
);
if
((
flags
&
~
(
PROPAGATE_AOF
|
PROPAGATE_REPL
))
!=
0
)
{
lua
P
ush
Error
(
lua
,
"Invalid replication flags. Use REPL_AOF, REPL_SLAVE, REPL_ALL or REPL_NONE."
);
return
1
;
lua
_p
ush
string
(
lua
,
"Invalid replication flags. Use REPL_AOF, REPL_SLAVE, REPL_ALL or REPL_NONE."
);
return
lua_error
(
lua
)
;
}
server
.
lua_repl
=
flags
;
return
0
;
...
...
@@ -579,16 +579,16 @@ int luaLogCommand(lua_State *lua) {
sds
log
;
if
(
argc
<
2
)
{
lua
P
ush
Error
(
lua
,
"redis.log() requires two arguments or more."
);
return
1
;
lua
_p
ush
string
(
lua
,
"redis.log() requires two arguments or more."
);
return
lua_error
(
lua
)
;
}
else
if
(
!
lua_isnumber
(
lua
,
-
argc
))
{
lua
P
ush
Error
(
lua
,
"First argument must be a number (log level)."
);
return
1
;
lua
_p
ush
string
(
lua
,
"First argument must be a number (log level)."
);
return
lua_error
(
lua
)
;
}
level
=
lua_tonumber
(
lua
,
-
argc
);
if
(
level
<
LL_DEBUG
||
level
>
LL_WARNING
)
{
lua
P
ush
Error
(
lua
,
"Invalid debug level."
);
return
1
;
lua
_p
ush
string
(
lua
,
"Invalid debug level."
);
return
lua_error
(
lua
)
;
}
/* Glue together all the arguments */
...
...
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