The uses of writebug in process shouldn't unfilelock immediately; they go
on to do other things with the bug and need to hold the lock. Remove the
automatic unfilelock from writebug and introduce a new 'unlockwritebug'
function (by analogy with 'lockreadbug'), used in service.
Make unfilelock produce a more sensible error message when the @filelocks
stack is empty, in case this ever happens again.
# -*- perl -*-
-# $Id: errorlib.in,v 1.25 2003/05/25 18:25:37 cjwatson Exp $
+# $Id: errorlib.in,v 1.26 2003/05/26 12:30:04 cjwatson Exp $
sub F_SETLK { 6; } sub F_WRLCK{ 1; }
$flockstruct= 'sslll'; # And there ought to be something for this too.
"$data->{severity}\n".
"$data->{versions}\n".
"$data->{fixed_versions}\n");
+}
+
+sub unlockwritebug {
+ writebug(@_);
&unfilelock;
}
}
sub unfilelock {
+ if (@filelocks == 0) {
+ warn "unfilelock called with no active filelocks!\n";
+ return;
+ }
local ($lockfile) = pop(@filelocks);
pop(@cleanups);
eval 'close(FLOCK'.($#filelocks+1).');' || warn "failed to close lock file $lockfile: $!";
#!/usr/bin/perl
-# $Id: service.in,v 1.74 2003/05/03 21:10:40 doogie Exp $
+# $Id: service.in,v 1.75 2003/05/26 12:30:04 cjwatson Exp $
# ^ more or less ^
#
# Usage: service <code>.nn
"\3\n".
"\7\n",@{escapelog(@log)},"\n\3\n") || &quit("writing db-h/$hash/$ref.log: $!");
close(L) || &quit("closing db-h/$hash/$ref.log: $!");
- writebug($ref, $data);
+ unlockwritebug($ref, $data);
$lowstate= "idle";
&dlex("savebug");
}