SQLite3 support
Matthias Andree
matthias.andree at gmx.de
Thu Jan 6 15:46:35 CET 2005
Stefan Bellon <sbellon at sbellon.de> writes:
> Recently I have played with SQLite3 support for RISC OS. I have SQLite3
> itself working. And even with Bogofilter it works really good.
>
> However I think there's a problem when doing "bogofilter -Q": The
> wordlist database is opened but not closed properly. This is due to the
> fact that query_config() terminates the whole program with
>
> exit(EX_OK);
>
> and open resources aren't closed properly.
I can reproduce this with BDB 4.2.
Just run bogofilter -Qvxd >/dev/null twice.
Thanks for the report, fix below (committed to CVS):
> Oh, BTW: Happy New Year to all!
Thank you, same to you.
Matthias
Index: src/bogoconfig.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/bogoconfig.c,v
retrieving revision 1.203
diff -u -u -r1.203 bogoconfig.c
--- src/bogoconfig.c 5 Jan 2005 02:03:33 -0000 1.203
+++ src/bogoconfig.c 6 Jan 2005 14:43:45 -0000
@@ -670,7 +670,7 @@
#define YN(b) (b ? "Yes" : "No")
#define NB(b) ((b != NULL && *b != '\0') ? b : "''")
-void query_config(void)
+rc_t query_config(void)
{
Q1 fprintf(stdout, "# %s version %s\n", progname, version);
Q1 fprintf(stdout, "\n");
@@ -724,7 +724,7 @@
#endif
#endif
- exit(EX_OK);
+ return EX_OK;
}
static void display_tag_array(const char *label, FIELD *array)
Index: src/bogoconfig.h
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/bogoconfig.h,v
retrieving revision 1.21
diff -u -u -r1.21 bogoconfig.h
--- src/bogoconfig.h 28 Dec 2004 16:24:22 -0000 1.21
+++ src/bogoconfig.h 6 Jan 2005 14:43:45 -0000
@@ -22,7 +22,7 @@
extern const char *spam_header_name;
extern const char *user_config_file;
-extern void query_config(void) __attribute__ ((noreturn));
+extern rc_t query_config(void);
extern void process_parameters(int argc, char **argv, bool warn_on_error);
extern void process_arg(int option, const char *name, const char *arg, priority_t precedence, arg_pass_t pass);
Index: src/bogofilter.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/bogofilter.c,v
retrieving revision 1.45
diff -u -u -r1.45 bogofilter.c
--- src/bogofilter.c 30 Nov 2004 01:51:59 -0000 1.45
+++ src/bogofilter.c 6 Jan 2005 14:43:45 -0000
@@ -77,10 +77,12 @@
bool write_msg = passthrough || Rtable;
bool classify_msg = write_msg || ((run_type & (RUN_NORMAL | RUN_UPDATE))) != 0;
- wordhash_t *words = register_aft ? wordhash_new() : NULL;
+ wordhash_t *words;
if (query)
- query_config();
+ return query_config();
+
+ words = register_aft ? wordhash_new() : NULL;
bogoreader_init(argc, argv);
More information about the bogofilter-dev
mailing list