[cvs] bogofilter/src datastore_db.c,1.71,1.72
Fast Bayesian spam filter along lines suggested by Paul Graham
Brought to you by:
m-a
From: <m-...@us...> - 2004-02-10 22:39:32
|
Update of /cvsroot/bogofilter/bogofilter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14269 Modified Files: datastore_db.c Log Message: Change comments and whitespace. Index: datastore_db.c =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/datastore_db.c,v retrieving revision 1.71 retrieving revision 1.72 diff -u -d -r1.71 -r1.72 --- datastore_db.c 10 Feb 2004 22:33:46 -0000 1.71 +++ datastore_db.c 10 Feb 2004 22:35:52 -0000 1.72 @@ -109,7 +109,7 @@ handle->path = xstrdup(path); handle->name = xmalloc(len); build_path(handle->name, len, path, name); - + handle->locked = false; handle->is_swapped = false; @@ -230,10 +230,11 @@ opt_flags = DB_RDONLY; else /* Read-write mode implied. Allow database to be created if - * necessary. DB_EXCL makes sure out locking doesn't fail if two + * necessary. DB_EXCL makes sure our locking doesn't fail if two * applications try to create a DB at the same time. */ opt_flags = 0; + /* retry when locking failed */ for (idx = 0; idx < COUNTOF(retryflags); idx += 1) { DB *dbp; @@ -253,6 +254,7 @@ handle->dbp = dbp; + /* set cache size */ if (db_cachesize != 0 && (ret = dbp->set_cachesize(dbp, db_cachesize/1024, (db_cachesize % 1024) * 1024*1024, 1)) != 0) { print_error(__FILE__, __LINE__, "(db) setcache( %s ), err: %d, %s", @@ -311,6 +313,7 @@ /* check file size limit */ check_fsize_limit(handle->fd, pagesize); + /* try fcntl lock */ if (db_lock(handle->fd, F_SETLK, (short int)(open_mode == DB_READ ? F_RDLCK : F_WRLCK))) { |