[cvs] bogofilter/src paths.c,1.49,1.50 paths.h,1.28,1.29 wordlists.c,1.113,1.114
Fast Bayesian spam filter along lines suggested by Paul Graham
Brought to you by:
m-a
From: David R. <re...@us...> - 2005-06-29 23:52:59
|
Update of /cvsroot/bogofilter/bogofilter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28435/src Modified Files: paths.c paths.h wordlists.c Log Message: Fix directory creation problem revealed by t.bogodir. Index: paths.h =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/paths.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- paths.h 6 May 2005 22:08:58 -0000 1.28 +++ paths.h 29 Jun 2005 23:52:50 -0000 1.29 @@ -51,6 +51,7 @@ bool paths_equal(bfpath *p1, bfpath *p2); void set_bogohome(const char *dirname); +void chk_bogohome(void); void set_bogohome_using_dirname(const char *dirname); void bogohome_cleanup(void); int set_wordlist_dir(const char* dir, priority_t precedence); Index: paths.c =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/paths.c,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -r1.49 -r1.50 --- paths.c 6 May 2005 22:13:59 -0000 1.49 +++ paths.c 29 Jun 2005 23:52:50 -0000 1.50 @@ -46,6 +46,21 @@ bogohome = xstrdup(path); } +void chk_bogohome(void) +{ + if (!check_directory(bogohome)) { + (void)fprintf(stderr, "%s: cannot find bogofilter directory.\n" + "You must specify a directory on the command line, in the config file,\n" +#ifndef __riscos__ + "or by using the BOGOFILTER_DIR or HOME environment variables.\n" +#else + "or by ensuring that <Bogofilter$Dir> is set correctly.\n" +#endif + "Program aborting.\n", progname); + exit(EX_ERROR); + } +} + static bool cant_find_bogohome(void) { if (bogohome != NULL) @@ -86,19 +101,8 @@ saved_precedence = precedence; - if (!check_directory(dir)) { - (void)fprintf(stderr, "%s: cannot find bogofilter directory.\n" - "You must specify a directory on the command line, in the config file,\n" -#ifndef __riscos__ - "or by using the BOGOFILTER_DIR or HOME environment variables.\n" -#else - "or by ensuring that <Bogofilter$Dir> is set correctly.\n" -#endif - "Program aborting.\n", progname); - rc = -1; - } - set_bogohome(dir); + xfree(dir); return rc; Index: wordlists.c =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/wordlists.c,v retrieving revision 1.113 retrieving revision 1.114 diff -u -d -r1.113 -r1.114 --- wordlists.c 29 Jun 2005 23:10:09 -0000 1.113 +++ wordlists.c 29 Jun 2005 23:52:50 -0000 1.114 @@ -224,6 +224,8 @@ /* set bogohome using first wordlist's directory */ set_wordlist_directory(); + chk_bogohome(); + /* add bogohome value to path structs */ for (list = word_lists; list != NULL; list = list->next) bfpath_set_bogohome(list->bfp); |