1 |
diff -up e-smith-lib-2.2.0/root/usr/lib/perl5/site_perl/esmith/tcpsvd.pm.serialize_peers e-smith-lib-2.2.0/root/usr/lib/perl5/site_perl/esmith/tcpsvd.pm |
2 |
--- e-smith-lib-2.2.0/root/usr/lib/perl5/site_perl/esmith/tcpsvd.pm.serialize_peers 2007-01-26 18:51:29.000000000 -0700 |
3 |
+++ e-smith-lib-2.2.0/root/usr/lib/perl5/site_perl/esmith/tcpsvd.pm 2010-10-11 16:25:37.000000000 -0600 |
4 |
@@ -29,6 +29,7 @@ Pape's ipsvd package - see http://smarde |
5 |
use esmith::NetworksDB; |
6 |
use esmith::ConfigDB; |
7 |
use esmith::util; |
8 |
+use esmith::lockfile; |
9 |
use Carp; |
10 |
|
11 |
=head2 configure_peers($service [, $peers_directory] ) |
12 |
@@ -95,6 +96,8 @@ sub configure_peers |
13 |
|
14 |
$nets{'127.0.0.1'} = 1; |
15 |
|
16 |
+ # Setup lock on peers directory while we manipulate it |
17 |
+ my $lock = esmith::lockfile::LockFileOrWait("$peers/local"); |
18 |
|
19 |
# Now manage a set of symlinks to the "local" instructions file |
20 |
foreach my $insfile (readdir (PEERS)) |
21 |
@@ -129,6 +132,9 @@ sub configure_peers |
22 |
symlink "0", "$peers/$gw_ip" or |
23 |
warn "Cannot add instructions file for $peers/$gw_ip: $!\n"; |
24 |
} |
25 |
+ |
26 |
+ # Unlock peers directory |
27 |
+ $lock && esmith::lockfile::UnlockFile($lock); |
28 |
} |
29 |
|
30 |
1; |