FYI, your code example is not even close to concurrency-safe.  If one
instance checks (-f $path) and finds no file, then context switches, and
instance #2 performs the same check, then both instances will try to
create a new file, and you'll probably end up with some weird mangled DB
file.

C

On Tue, 2002-02-26 at 00:33, Nix wrote:
>          if ( -f $path ) {
>            tie %{$self->{accum}},"AnyDBM_File",$path, O_RDWR,   #open rw w/lock
>                        (oct ($main->{conf}->{auto_whitelist_file_mode}) & 0666)
>              or die "Cannot open existing auto_whitelist_path $path: $!\n";
>            
>          } else {
>            tie %{$self->{accum}},"AnyDBM_File",$path, O_RDWR|O_CREAT,   #open rw 
>w/lock
>                        (oct ($main->{conf}->{auto_whitelist_file_mode}) & 0666)
>              or die "Cannot open auto_whitelist_path $path for creation: $!\n";
>          }


_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk

Reply via email to