Extend sendFileWithContent() to handle custom content length in basebackup.c
sendFileWithContent() previously got the content length by using strlen(), assuming that the content given is always a string. Some patches are under discussion to pass binary contents to a base backup stream, where an arbitrary length needs to be given by the caller instead. The patch extends sendFileWithContent() to be able to handle this case, where len < 0 can be used to indicate an arbitrary length rather than rely on strlen() for the content length. A comment in sendFileWithContent() mentioned the backup_label file. However, this routine is used by more file types, like the tablespace map, so adjust it in passing. Note: This commit has been initially applied on v17~ as of 7606175991f, and is required for a follow-up commit that addresses an issue down to v15. Author: David Steele Discussion: https://postgr.es/m/[email protected] Discussion: https://postgr.es/m/[email protected] Backpatch-through: 15 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/d2c1e18de9d1604130d7d4a2eb3bcc6e0de7a545 Modified Files -------------- src/backend/backup/basebackup.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-)
