Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d06bc61

Browse files
committed
Fix access to uninitalized variables in GCC
1 parent 51b2168 commit d06bc61

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/backend/storage/file/cfs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,8 @@ static bool cfs_gc_file(char* map_path)
559559
close(md2);
560560
md2 = -1;
561561
newSize = pg_atomic_read_u32(&newMap->usedSize);
562+
virtSize = pg_atomic_read_u32(&newMap->virtSize);
563+
n_pages = virtSize / BLCKSZ;
562564
remove_backups = false;
563565
goto ReplaceMap;
564566
}

src/backend/storage/smgr/md.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,12 +502,15 @@ mdunlinkfork(RelFileNodeBackend rnode, ForkNumber forkNum, bool isRedo)
502502
if (md_use_compression(rnode, forkNum))
503503
{
504504
File file = PathNameOpenFile(path, O_RDWR | PG_BINARY | PG_COMPRESSION, 0);
505+
ret = -1;
505506
if (file >= 0) {
506507
elog(LOG, "Truncate file %s", path);
507508
if (FileTruncate(file, 0) < 0) {
508509
ereport(WARNING,
509510
(errcode_for_file_access(),
510511
errmsg("could not truncate file \"%s\": %m", path)));
512+
} else {
513+
ret = 0;
511514
}
512515
}
513516
FileClose(file);

0 commit comments

Comments
 (0)