summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 79f6721)
raw | patch | inline | side by side (parent: 79f6721)
author | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 9 Mar 2009 09:36:16 +0000 (09:36 +0000) | ||
committer | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 9 Mar 2009 09:36:16 +0000 (09:36 +0000) |
More debugging messages about locking.
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13511 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13511 594d385d-05f5-0310-b6e9-bd551577e9d8
trunk/gosa-si/modules/DBsqlite.pm | patch | blob | history |
index c1d7b84a6d7e2e362a1814a9337fe9a6c1b478c0..ab66fce438b6ebe7811e51f0e23b42d4e1c6828f 100644 (file)
use Data::Dumper;
use GOSA::GosaSupportDaemon;
use Time::HiRes qw(usleep);
-use Fcntl ':flock'; # import LOCK_* constants
+use Fcntl qw/:DEFAULT :flock/; # import LOCK_* constants
my $col_names = {};
sub lock {
my $self = shift;
- open($self->{db_lock_handle}, ">>".($self->{db_lock})) unless ref $self->{db_lock_handle};
- flock($self->{db_lock_handle},LOCK_EX);
+ if(not ref $self->{db_lock_handle}) {
+ sysopen($self->{db_lock_handle}, $self->{db_lock}, O_RDWR|O_CREAT, 0600) or &main::daemon_log("0 ERROR: Opening the lockfile for database ".$self->{db_name}." failed with $!", 1);
+ }
+ flock($self->{db_lock_handle}, LOCK_EX);
seek($self->{db_lock_handle}, 0, 2);
-
- chown($main::root_uid, $main::adm_gid, $self->{db_lock_handle});
- chmod(0640, $self->{db_lock_handle});
}
sub unlock {
my $self = shift;
- flock($self->{db_lock_handle},LOCK_UN);
+ if(not ref $self->{db_lock_handle}) {
+ &main::daemon_log("0 BIG ERROR: Lockfile for databse ".$self->{db_name}."got closed within critical section!", 1);
+ }
+ flock($self->{db_lock_handle}, LOCK_UN);
}