etcupdate: Preserve permissions when installing a resolved file.

Similar to the change in 1a04446f08, use
cat to overwrite the contents of the existing file rather than cp so
that metadata of the existing file such as permissions and ownership
is preserved.

PR:		255514
Reported by:	uqs

(cherry picked from commit f8287caae4)
This commit is contained in:
John Baldwin 2022-05-25 14:20:40 -07:00
parent 5d7b7a98e5
commit 8660d530f7

View file

@ -673,8 +673,9 @@ install_resolved()
return 1
fi
log "cp -Rp ${CONFLICTS}$1 ${DESTDIR}$1"
cp -Rp ${CONFLICTS}$1 ${DESTDIR}$1 >&3 2>&1
# Use cat rather than cp to preserve metadata
log "cat ${CONFLICTS}$1 > ${DESTDIR}$1"
cat ${CONFLICTS}$1 > ${DESTDIR}$1 2>&3
post_install_file $1
return 0
}