Fix bug: try harder to open the database files.
authorChris Hanson <org/chris-hanson/cph>
Tue, 15 Oct 1996 19:34:26 +0000 (19:34 +0000)
committerChris Hanson <org/chris-hanson/cph>
Tue, 15 Oct 1996 19:34:26 +0000 (19:34 +0000)
v7/src/edwin/nntp.scm

index 0042c41a5b8eaadbea841c0b4969f416176cd6cc..bf82d8322d73093d777491776281a4e867f865ee 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: nntp.scm,v 1.6 1996/10/15 18:58:27 cph Exp $
+;;;    $Id: nntp.scm,v 1.7 1996/10/15 19:34:26 cph Exp $
 ;;;
 ;;;    Copyright (c) 1995-96 Massachusetts Institute of Technology
 ;;;
 \f
 ;;;; Header Database
 
-(define (news-group:header-gdbf group open?)
+(define (news-group:header-gdbf group create?)
   (let ((gdbf (news-group:%header-gdbf group)))
     (if (eq? 'UNKNOWN gdbf)
-       (and open?
-            (let ((gdbf
-                   (and (gdbm-available?)
-                        (let ((pathname
-                               (news-group:header-gdbf-pathname group)))
-                          (guarantee-init-file-directory pathname)
-                          (gdbm-open pathname 0 GDBM_WRCREAT #o666)))))
-              (if gdbf (gdbm-setopt gdbf gdbm_fastmode 1))
-              (set-news-group:%header-gdbf! group gdbf)
-              gdbf))
+       (let ((gdbf
+              (and (gdbm-available?)
+                   (let ((pathname
+                          (news-group:header-gdbf-pathname group)))
+                     (guarantee-init-file-directory pathname)
+                     (and (or create? (file-exists? pathname))
+                          (gdbm-open pathname 0 GDBM_WRCREAT #o666))))))
+         (if gdbf (gdbm-setopt gdbf gdbm_fastmode 1))
+         (set-news-group:%header-gdbf! group gdbf)
+         gdbf)
        gdbf)))
 
 (define (news-group:header-gdbf-pathname group)
 \f
 ;;;; Body Database
 
-(define (news-group:body-gdbf group open?)
+(define (news-group:body-gdbf group create?)
   (let ((gdbf (news-group:%body-gdbf group)))
     (if (eq? 'UNKNOWN gdbf)
-       (and open?
-            (let ((gdbf
-                   (and (gdbm-available?)
-                        (let ((pathname
-                               (news-group:body-gdbf-pathname group)))
-                          (guarantee-init-file-directory pathname)
-                          (gdbm-open pathname 0 GDBM_WRCREAT #o666)))))
-              (if gdbf (gdbm-setopt gdbf gdbm_fastmode 1))
-              (set-news-group:%body-gdbf! group gdbf)
-              gdbf))
+       (let ((gdbf
+              (and (gdbm-available?)
+                   (let ((pathname
+                          (news-group:body-gdbf-pathname group)))
+                     (guarantee-init-file-directory pathname)
+                     (and (or create? (file-exists? pathname))
+                          (gdbm-open pathname 0 GDBM_WRCREAT #o666))))))
+         (if gdbf (gdbm-setopt gdbf gdbm_fastmode 1))
+         (set-news-group:%body-gdbf! group gdbf)
+         gdbf)
        gdbf)))
 
 (define (news-group:body-gdbf-pathname group)