mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Checks if the binary file is generated by a newer version of SnapRAID.
This commit is contained in:
parent
11888d9e0d
commit
60d7189bdb
1 changed files with 10 additions and 1 deletions
11
state.c
11
state.c
|
|
@ -2039,11 +2039,20 @@ static void state_read_binary(struct snapraid_state* state, const char* path, ST
|
|||
tommy_array_init(&disk_mapping);
|
||||
|
||||
ret = sread(f, buffer, 12);
|
||||
if (ret < 0 || memcmp(buffer, "SNAPCNT1\n\3\0\0", 12) != 0) {
|
||||
if (ret < 0) {
|
||||
decoding_error(path, f);
|
||||
fprintf(stderr, "Invalid header!\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (memcmp(buffer, "SNAPCNT1\n\3\0\0", 12) != 0) {
|
||||
if (memcmp(buffer, "SNAPCNT", 7) != 0) {
|
||||
decoding_error(path, f);
|
||||
fprintf(stderr, "Invalid header!\n");
|
||||
} else {
|
||||
fprintf(stderr, "The content file '%s' was generated with a newer version of SnapRAID!\n", path);
|
||||
}
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
while (1) {
|
||||
char buffer[PATH_MAX];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue