[cvs] bogofilter datastore_db.c,1.23,1.24

Matthias Andree matthias.andree at gmx.de
Sat Nov 16 17:52:50 CET 2002


gyepi at users.sourceforge.net writes:

> Update of /cvsroot/bogofilter/bogofilter
> In directory usw-pr-cvs1:/tmp/cvs-serv14363
>
> Modified Files:
> 	datastore_db.c 
> Log Message:
> ignore cannot-lock-mmapped-file error for rea-only database

Isn't this going to break once a writer tries to lock while the
read-only reader has not yet finished at that time?

>
> Index: datastore_db.c
> ===================================================================
> RCS file: /cvsroot/bogofilter/bogofilter/datastore_db.c,v
> retrieving revision 1.23
> retrieving revision 1.24
> diff -C2 -d -r1.23 -r1.24
> *** datastore_db.c	11 Nov 2002 00:57:59 -0000	1.23
> --- datastore_db.c	16 Nov 2002 15:42:34 -0000	1.24
> ***************
> *** 261,268 ****
> --- 261,276 ----
>       fprintf(stderr, "[%lu] Acquiring read lock  on %s\n", (unsigned long) handle->pid, handle->filename);
>   
> +   errno = 0;
> +   
>     if (db_lock(handle, F_SETLKW, F_RDLCK) != 0){
> +     if (errno == EAGAIN){
> +   	if (DEBUG_DATABASE(2))
> +     	  fprintf(stderr, "[%lu] Faked lock %s.\n", (unsigned long) handle->pid, handle->filename);
> +     }
> +     else {
>       fprintf(stderr, "[%lu] Error acquiring read lock on %s\n", (unsigned long) handle->pid, handle->filename);
>       SYSLOG_ERROR( "Error acquiring read lock on %s\n", handle->filename);
>       exit(2);
> +     }
>     }
>   
> ***************
> *** 375,382 ****
>   	do_lock_msg("Trying");
>         
> !       if (db_lock(handle, cmd, type) == 0){
>           if (DEBUG_DATABASE(1))
>             do_lock_msg("Got");
>           
>           handle->locked = TRUE;
>         }
> --- 383,396 ----
>   	do_lock_msg("Trying");
>         
> !        if (db_lock(handle, cmd, type) == 0){
>           if (DEBUG_DATABASE(1))
>             do_lock_msg("Got");
>           
> +         handle->locked = TRUE;
> +        }
> +        else if (type == F_RDLCK && errno == EAGAIN){
> +         if (verbose)
> +           do_lock_msg("Faked acquired");
> + 	
>           handle->locked = TRUE;
>         }
>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by: To learn the basics of securing 
> your web site with SSL, click here to get a FREE TRIAL of a Thawte 
> Server Certificate: http://www.gothawte.com/rd524.html
> _______________________________________________
> bogofilter-cvs mailing list
> bogofilter-cvs at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bogofilter-cvs
>
>

-- 
Matthias Andree



More information about the bogofilter-dev mailing list