Hi All, The following code gives the pid of the process holding the lock as 0 when run with perl 5.6.1 on Redhat linux 7.2. It works fine with perl 5.6.0 on the same machine. The code that locks the file works fine (tested by getting the lock information with C code and using 5.6.0 perl). Has anyone else faced a similar problem or am I missing something?
#!/usr/local/bin/perl -w use strict; use Fcntl; my $filename = shift || die "Usage : $0 <filename>\n"; my $fmtstr = 's s l l i'; my ($linfo, $ltype, $lwhence, $lstart, $llength, $lpid) = (0, 0, 0, 0, 0, 0); open (INPFILE, $filename) or die "Cannot open $filename : $!\n"; $ltype = F_RDLCK; $linfo = pack ($fmtstr, $ltype, $lwhence, $lstart, $llength, $lpid); fcntl (INPFILE, F_GETLK, $linfo) or die "Failed while getting lock information for $filename : $!\n"; ($ltype, $lwhence, $lstart, $llength, $lpid) = unpack ($fmtstr, $linfo); if ($ltype == F_WRLCK) { print "This file has a write lock on it : by process id ", $lpid, "\n"; exit (1); } close (INPFILE); TIA, Sudarsan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]