]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/import/pull-job.c
import: enable sparse file writing logic only for files we create
authorLennart Poettering <lennart@poettering.net>
Thu, 19 Aug 2021 15:22:18 +0000 (17:22 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 20 Aug 2021 19:56:59 +0000 (21:56 +0200)
commitbf284aee235247b71fbd62b331d35ff9f7907775
tree47d637d3f3888a865211734913f2ddc1857c40d0
parent53e03c9692505384ed4ec743791ddf2ba18a455f
import: enable sparse file writing logic only for files we create

Only if we create a file we know for sure that it is empty and hence our
sparse file logic of skipping over NUL bytes can can work. If we hwoever
are called to write data to some existing file/block device, we must do
regular writes to override everything that might be in place before.

Hence, conditionalize sparse file writing on the write offset not being
configured (which is how we internally distinguish write to existing
file and write to new file)
src/import/import-raw.c
src/import/pull-job.c