void-packages/srcpkgs/intltool/patches/avoid-process-race.patch
2019-01-01 22:47:10 -02:00

36 lines
901 B
Diff

https://bazaar.launchpad.net/~intltool/intltool/trunk/revision/748?start_revid=748
=== modified file 'intltool-merge.in'
--- intltool-merge.in 2014-11-24 02:37:01 +0000
+++ intltool-merge.in 2017-05-18 19:09:18 +0000
@@ -43,6 +43,7 @@
use Text::Wrap;
use File::Basename;
use Encode;
+use Fcntl qw(:flock);
my $must_end_tag = -1;
my $last_depth = -1;
@@ -392,11 +393,14 @@
sub get_cached_translation_database
{
+ open(my $lockfh, ">", "$cache_file.lock") or die $!;
+ flock($lockfh, LOCK_EX) or die "Could not lock '$cache_file.lock' - $!";
my $cache_file_age = -M $cache_file;
if (defined $cache_file_age)
{
if ($cache_file_age <= &get_newest_po_age)
{
+ close($lockfh);
&load_cache;
return;
}
@@ -404,6 +408,7 @@
}
&create_cache;
+ close($lockfh);
}
sub add_translation