mirror of
https://github.com/postgres/postgres.git
synced 2025-11-24 00:23:06 +03:00
Fix genbki.pl and Gen_fmgrtab.pl to use PID-specific temp file names,
so that it's safe if a parallel make chooses to run two concurrent copies. Also, work around a memory leak in some versions of Perl.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
# Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
|
||||
# Portions Copyright (c) 1994, Regents of the University of California
|
||||
#
|
||||
# $PostgreSQL: pgsql/src/backend/catalog/Catalog.pm,v 1.2 2010/01/05 02:34:03 tgl Exp $
|
||||
# $PostgreSQL: pgsql/src/backend/catalog/Catalog.pm,v 1.3 2010/01/05 20:23:32 tgl Exp $
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
@@ -170,11 +170,14 @@ sub Catalogs
|
||||
}
|
||||
|
||||
# Rename temporary files to final names.
|
||||
# Call this function with the final file name --- we append .tmp automatically
|
||||
# Call this function with the final file name and the .tmp extension
|
||||
# Note: recommended extension is ".tmp$$", so that parallel make steps
|
||||
# can't use the same temp files
|
||||
sub RenameTempFile
|
||||
{
|
||||
my $final_name = shift;
|
||||
my $temp_name = $final_name . '.tmp';
|
||||
my $extension = shift;
|
||||
my $temp_name = $final_name . $extension;
|
||||
print "Writing $final_name\n";
|
||||
rename($temp_name, $final_name) || die "rename: $temp_name: $!";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user