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
MFC after:	1 week
This commit is contained in:
John Baldwin 2022-05-25 14:20:40 -07:00
parent 431944fb5f
commit f8287caae4

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
}