unpack: apply correctly file permissions to existent files.

Will be backported to the 0.26.x branch.