8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 05:23:03 +01:00

Applied modified patch from Damyan fixing piped decompression

This commit is contained in:
Alex Peshkoff 2018-09-05 18:02:45 +03:00
parent 04508a0f73
commit 9f3fa49fe3

View File

@ -1494,7 +1494,18 @@ void NBackup::restore_database(const BackupFiles& files, bool inc_rest)
// We may also add SCN check, but GUID check covers this case too
if (memcmp(&bakheader.prev_guid, &prev_guid, sizeof(Guid)) != 0)
status_exception::raise(Arg::Gds(isc_nbackup_wrong_orderbk) << bakname.c_str());
seek_file(backup, bakheader.page_size);
// Emulate seek_file(backup, bakheader.page_size)
// Backup is stream-oriented, if -decompress is used pipe can't be seek()'ed
FB_SIZE_T left = bakheader.page_size - sizeof(bakheader);
while (left)
{
char char_buf[1024];
FB_SIZE_T step = left > sizeof(char_buf) ? sizeof(char_buf) : left;
if (read_file(backup, &char_buf, step) != step)
status_exception::raise(Arg::Gds(isc_nbackup_err_eofhdrbk) << bakname.c_str());
left -= step;
}
if (!inc_rest)
delete_database = true;