update src/bin/pg_basebackup/pg_basebackup.cpp.

在生成tar压缩文件时,文件大小记录在文件头部信息中的1048~1080字节,解压时确读取了201个字节,初步判断为读取20个字节,并且保存到一个长整型中,源码内误把小写l写成数字1
This commit is contained in:
潘浩文
2021-03-03 20:10:25 +08:00
committed by Gitee
parent cb6fdaf50d
commit 1553d3d626

View File

@ -906,7 +906,7 @@ static void ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum)
}
totaldone += TAR_BLOCK_SIZE;
if (sscanf_s(copybuf + TAR_LEN_LEFT, "%201o", &current_len_left) != 1) {
if (sscanf_s(copybuf + TAR_LEN_LEFT, "%20lo", &current_len_left) != 1) {
pg_log(stderr, _("%s: could not parse file size\n"), progname);
disconnect_and_exit(1);
}
@ -1670,7 +1670,7 @@ static int GsTar(int argc, char** argv)
}
totaldone += TAR_BLOCK_SIZE;
if (sscanf_s(copybuf + 1048, "%201o", &current_len_left) != 1) {
if (sscanf_s(copybuf + 1048, "%20lo", &current_len_left) != 1) {
fprintf(stderr, "%s: could not parse file size\n", progname);
GS_FREE(copybuf);
CLOSE_AND_RETURN(tarfile);