Skip to content

Commit 6d51bb1

Browse files
committed
Fix copy bitmap.
1 parent 9c475ec commit 6d51bb1

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

backup.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,6 @@ void make_pagemap_from_ptrack(parray *files)
987987
if (p->ptrack_path != NULL)
988988
{
989989
DataPage page;
990-
int i;
991990
struct stat st;
992991
FILE *ptrack_file = fopen(p->ptrack_path, "r");
993992
if (ptrack_file == NULL)
@@ -996,23 +995,17 @@ void make_pagemap_from_ptrack(parray *files)
996995
strerror(errno));
997996
}
998997

999-
elog(LOG, "Start copy bitmap from ptrack:%s", p->ptrack_path);
1000998
fstat(fileno(ptrack_file), &st);
1001999
p->pagemap.bitmapsize = st.st_size-(st.st_size/BLCKSZ)*MAXALIGN(SizeOfPageHeaderData);
10021000
p->pagemap.bitmap = pg_malloc(p->pagemap.bitmapsize);
1003-
while(fread(page.data, BLCKSZ, 1, ptrack_file) == BLCKSZ)
1001+
1002+
elog(LOG, "Start copy bitmap from ptrack:%s size:%i", p->ptrack_path, p->pagemap.bitmapsize);
1003+
while(fread(page.data, BLCKSZ, 1, ptrack_file) == 1)
10041004
{
10051005
char *map = PageGetContents(page.data);
1006-
memcpy(p->pagemap.bitmap, map, BLCKSZ-MAXALIGN(SizeOfPageHeaderData));
1006+
memcpy(p->pagemap.bitmap, map, BLCKSZ - MAXALIGN(SizeOfPageHeaderData));
10071007
}
10081008
fclose(ptrack_file);
1009-
for(i = 0; i < p->pagemap.bitmapsize; i++)
1010-
if (p->pagemap.bitmap[i] != 0)
1011-
goto end_loop;
1012-
1013-
pg_free(p->pagemap.bitmap);
1014-
p->pagemap.bitmapsize = 0;
10151009
}
1016-
end_loop:;
10171010
}
10181011
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy