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
a5dce407
Commit
a5dce407
authored
May 04, 2011
by
antirez
Browse files
if /dev/urandom is not available use rand() to get a random node name
parent
35845afb
Changes
2
Show whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
a5dce407
...
@@ -24,12 +24,10 @@ void clusterGetRandomName(char *p) {
...
@@ -24,12 +24,10 @@ void clusterGetRandomName(char *p) {
char
*
charset
=
"0123456789abcdef"
;
char
*
charset
=
"0123456789abcdef"
;
int
j
;
int
j
;
if
(
!
fp
)
{
if
(
fp
==
NULL
||
fread
(
p
,
REDIS_CLUSTER_NAMELEN
,
1
,
fp
)
==
0
)
{
redisLog
(
REDIS_WARNING
,
for
(
j
=
0
;
j
<
REDIS_CLUSTER_NAMELEN
;
j
++
)
"Unrecovarable error: can't open /dev/urandom:%s"
,
strerror
(
errno
));
p
[
j
]
=
rand
();
exit
(
1
);
}
}
fread
(
p
,
REDIS_CLUSTER_NAMELEN
,
1
,
fp
);
for
(
j
=
0
;
j
<
REDIS_CLUSTER_NAMELEN
;
j
++
)
for
(
j
=
0
;
j
<
REDIS_CLUSTER_NAMELEN
;
j
++
)
p
[
j
]
=
charset
[
p
[
j
]
&
0x0F
];
p
[
j
]
=
charset
[
p
[
j
]
&
0x0F
];
fclose
(
fp
);
fclose
(
fp
);
...
...
src/t_zset.c
View file @
a5dce407
...
@@ -1233,7 +1233,7 @@ int zuiNext(zsetopsrc *op, zsetopval *val) {
...
@@ -1233,7 +1233,7 @@ int zuiNext(zsetopsrc *op, zsetopval *val) {
if
(
op
->
type
==
REDIS_SET
)
{
if
(
op
->
type
==
REDIS_SET
)
{
iterset
*
it
=
&
op
->
iter
.
set
;
iterset
*
it
=
&
op
->
iter
.
set
;
if
(
op
->
encoding
==
REDIS_ENCODING_INTSET
)
{
if
(
op
->
encoding
==
REDIS_ENCODING_INTSET
)
{
if
(
!
intsetGet
(
it
->
is
.
is
,
it
->
is
.
ii
,
&
val
->
ell
))
if
(
!
intsetGet
(
it
->
is
.
is
,
it
->
is
.
ii
,
(
int64_t
*
)
&
val
->
ell
))
return
0
;
return
0
;
val
->
score
=
1
.
0
;
val
->
score
=
1
.
0
;
...
...
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