From c246ad3432b90eabbf645b6207885307907d6339 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 7 Jun 2021 11:28:47 +0200 Subject: libsquashfs: fix: also preserve alignment flag in block processor Currently, when the block processor aggreagtes fragments into a fragment block, it applies the "don't compress" flag if any of the original framgnets has it set, but the "align to device block" flag is lost. This commit ensures that both flags get applied to the fragment block if set. Signed-off-by: David Oberhollenzer --- lib/sqfs/block_processor/backend.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/sqfs/block_processor/backend.c b/lib/sqfs/block_processor/backend.c index acff7f5..b443c9d 100644 --- a/lib/sqfs/block_processor/backend.c +++ b/lib/sqfs/block_processor/backend.c @@ -202,7 +202,8 @@ static int process_completed_fragment(sqfs_block_processor_t *proc, offset = 0; proc->frag_block = frag; proc->frag_block->index = index; - proc->frag_block->flags &= SQFS_BLK_DONT_COMPRESS; + proc->frag_block->flags &= + (SQFS_BLK_DONT_COMPRESS | SQFS_BLK_ALIGN); proc->frag_block->flags |= SQFS_BLK_FRAGMENT_BLOCK; } else { index = proc->frag_block->index; @@ -213,7 +214,8 @@ static int process_completed_fragment(sqfs_block_processor_t *proc, proc->frag_block->size += frag->size; proc->frag_block->flags |= - (frag->flags & SQFS_BLK_DONT_COMPRESS); + (frag->flags & + (SQFS_BLK_DONT_COMPRESS | SQFS_BLK_ALIGN)); } if (proc->frag_tbl != NULL) { -- cgit v1.2.3