1
*** ./sendmail-8.13.8/contrib/qtool.pl Wed Mar 5 16:11:54 2003
2
--- ./sendmail-8.13.8/contrib/qtool.pl Wed Mar 5 15:59:10 2003
10
$result = sysopen(FILE_TO_LOCK, $file_name, Fcntl::O_RDWR);
13
return (undef, "Unable to open '$file_name': $!");
16
! $result = flock(FILE_TO_LOCK, Fcntl::LOCK_EX | Fcntl::LOCK_NB);
19
return (undef, "Could not obtain lock on '$file_name': $!");
22
return (\*FILE_TO_LOCK, undef);
27
my $file_name = shift;
33
+ # Supposedly under linux
34
+ # my $FLOCK_STRUCT = 's s l l i';
35
+ # But I think perl's using __off64_t instead of __off_t
36
+ # my $FLOCK_STRUCT = 's s l l l l i';
37
+ # Screw it, its all zero anyway...
39
+ $FLOCK_STRUCT = 's H60';
40
+ $fcntllock = pack($FLOCK_STRUCT, F_WRLCK,
41
+ "000000000000000000000000000000000000000000000000000000000000");
43
$result = sysopen(FILE_TO_LOCK, $file_name, Fcntl::O_RDWR);
46
+ # print "Unable to open '$file_name': $!";
47
return (undef, "Unable to open '$file_name': $!");
50
! $result = fcntl (FILE_TO_LOCK, F_SETLK, $fcntllock);
52
! # print "Fcntl Lock result on $file_name = $result\n";
54
! # $result = flock(FILE_TO_LOCK, Fcntl::LOCK_EX | Fcntl::LOCK_NB);
55
! # print "Lock result on $file_name = $result\n";
57
! if ($result ne "0 but true")
59
+ # print "Could not obtain lock on '$file_name': $!\n";
60
return (undef, "Could not obtain lock on '$file_name': $!");
63
return (\*FILE_TO_LOCK, undef);
73
! $result = flock($file, Fcntl::LOCK_UN);
76
return "Unlock failed on '$result': $!";
89
! $FLOCK_STRUCT = 's H60';
90
! $fcntllock = pack($FLOCK_STRUCT, F_UNLCK,
91
! "000000000000000000000000000000000000000000000000000000000000");
92
! $result = fcntl (FILE_TO_LOCK, F_SETLK, $fcntllock);
94
! if ($result ne "0 but true")
95
! # $result = flock($file, Fcntl::LOCK_UN);
98
return "Unlock failed on '$result': $!";