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
bd044659
Commit
bd044659
authored
Apr 02, 2012
by
antirez
Browse files
DUMP / RESTORE: store RDB version in little endian.
parent
4de6c9a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
bd044659
...
...
@@ -1479,8 +1479,8 @@ void createDumpPayload(rio *payload, robj *o) {
* ----------------+---------------------+--------------+
* The SHA1 is just 8 bytes of truncated SHA1 of everything excluding itself.
* The 2 bytes RDB version is a little endian unsigned integer. */
buf
[
0
]
=
(
REDIS_RDB_VERSION
>>
8
)
&
0xff
;
buf
[
1
]
=
REDIS_RDB_VERSION
&
0xff
;
buf
[
0
]
=
REDIS_RDB_VERSION
&
0xff
;
buf
[
1
]
=
(
REDIS_RDB_VERSION
>>
8
)
&
0xff
;
payload
->
io
.
buffer
.
ptr
=
sdscatlen
(
payload
->
io
.
buffer
.
ptr
,
buf
,
2
);
SHA1Init
(
&
ctx
);
...
...
@@ -1501,7 +1501,7 @@ int verifyDumpPayload(unsigned char *p, size_t len) {
if
(
len
<
10
)
return
REDIS_ERR
;
footer
=
p
+
(
len
-
10
);
rdbver
=
(
footer
[
0
]
<<
8
)
|
footer
[
1
];
rdbver
=
(
footer
[
1
]
<<
8
)
|
footer
[
0
];
if
(
rdbver
!=
REDIS_RDB_VERSION
)
return
REDIS_ERR
;
SHA1Init
(
&
ctx
);
SHA1Update
(
&
ctx
,
p
,
len
-
8
);
...
...
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