mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-28 19:06:42 -05:00
Add the deplete operation at the data stream
It's used to read the content file up to the end to verify its CRC.
This commit is contained in:
parent
104c47d106
commit
7e1d9138b5
3 changed files with 65 additions and 28 deletions
|
|
@ -1564,26 +1564,7 @@ static void decoding_error(const char* path, STREAM* f)
|
|||
|
||||
log_fatal("Decoding error in '%s' at offset %" PRIi64 "\n", path, stell(f));
|
||||
|
||||
buf[0] = 0;
|
||||
buf[1] = 0;
|
||||
buf[2] = 0;
|
||||
buf[3] = 0;
|
||||
|
||||
/* read until the end of the file */
|
||||
while (1) {
|
||||
int c = sgetc(f);
|
||||
if (c == EOF) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* keep the last four bytes */
|
||||
buf[0] = buf[1];
|
||||
buf[1] = buf[2];
|
||||
buf[2] = buf[3];
|
||||
buf[3] = c;
|
||||
}
|
||||
|
||||
if (serror(f)) {
|
||||
if (sdeplete(f, buf) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error flushing the content file '%s' at offset %" PRIi64 "\n", path, stell(f));
|
||||
exit(EXIT_FAILURE);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue