~ubuntu-branches/ubuntu/oneiric/bogofilter/oneiric

« back to all changes in this revision

Viewing changes to src/bogoutil.c

  • Committer: Bazaar Package Importer
  • Author(s): Tollef Fog Heen
  • Date: 2005-11-10 11:49:05 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20051110114905-s0dfdxew1kaonhyw
Tags: 0.96.5-1ubuntu1
* Resynchronise with Debian.
  - bogofilter-qdbm still disabled, bogofilter-tdb went away upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: bogoutil.c,v 1.226 2005/06/20 00:48:56 relson Exp $ */
 
1
/* $Id: bogoutil.c,v 1.230 2005/09/11 12:51:52 relson Exp $ */
2
2
 
3
3
/*****************************************************************************
4
4
 
68
68
    fprintf(stderr, "Error accessing file or directory '%s'.\n", bfp->filepath);
69
69
    if (errno != 0)
70
70
        fprintf(stderr, "error #%d - %s.\n", errno, strerror(errno));
71
 
    ds_cleanup(dbe);
 
71
    if (dbe != NULL)
 
72
        ds_cleanup(dbe);
72
73
    exit(EX_ERROR);
73
74
}
74
75
 
432
433
        dsv_t val;
433
434
        word_t *word_robx = word_news(ROBX_W);
434
435
 
 
436
        /* since compute_robinson_x() closes the wordlists, 
 
437
           init_wordlist() must be called again */
 
438
        init_wordlist("word", bfp->filepath, 0, WL_REGULAR);
 
439
 
435
440
        open_wordlists(DS_WRITE);
436
441
 
437
442
        val.goodcount = 0;
443
448
                begin_wordlist(word_lists);
444
449
            }
445
450
        } while (ret == DS_ABORT_RETRY);
446
 
            
447
451
 
448
452
        close_wordlists(true);
449
453
        free_wordlists();
813
817
{
814
818
    bfpath_mode mode = BFP_ERROR;
815
819
 
816
 
    switch(cmd) {
 
820
    switch (cmd) {
817
821
    case M_LOAD:
818
822
        mode = BFP_MAY_CREATE;
819
823
        break;
851
855
    fBogoutil = true;
852
856
 
853
857
    signal_setup();                     /* setup to catch signals */
 
858
    atexit(bf_exit);
854
859
 
855
860
    progtype = build_progtype(progname, DB_TYPE);
856
861
 
873
878
    bfpath_set_bogohome(bfp);
874
879
 
875
880
    mode = get_mode(flag);
 
881
    if (bfpath_check_mode(bfp, mode)) {
 
882
        if (bfp->isdir)
 
883
            bfpath_set_filename(bfp, WORDLIST);
 
884
    }
 
885
 
876
886
    if (!bfpath_check_mode(bfp, mode)) {
877
887
        fprintf(stderr, "Can't open wordlist '%s'\n", bfp->filepath);
878
888
        exit(EX_ERROR);
879
889
    }
880
890
 
881
 
    switch(flag) {
 
891
    errno = 0;          /* clear error status */
 
892
 
 
893
    switch (flag) {
882
894
        case M_RECOVER:
883
895
            ds_init(bfp);
884
896
            rc = ds_recover(bfp, false);