summaryrefslogtreecommitdiffstats
path: root/transact.scm
diff options
context:
space:
mode:
Diffstat (limited to 'transact.scm')
-rw-r--r--transact.scm13
1 files changed, 7 insertions, 6 deletions
diff --git a/transact.scm b/transact.scm
index 59a06fe..83b37a7 100644
--- a/transact.scm
+++ b/transact.scm
@@ -90,7 +90,7 @@
"~$" (substring file (min 2 (max 0 (- filen 10))) filen)))))
(define (word-lock:certificate lockpath)
- (define iport (open-file lockpath "rb"))
+ (define iport (and (file-exists? lockpath) (open-file lockpath 'rb)))
(and
iport
(call-with-open-ports
@@ -143,7 +143,7 @@
(cond ((and conflict (substring? "-> " conflict))
=> (lambda (idx)
(substring conflict (+ 3 idx) (string-length conflict))))
- (conflict (slib:error 'bad 'emacs 'lock lockpath conflict))
+ ((and conflict (not (equal? conflict ""))) (slib:error 'bad 'emacs 'lock lockpath conflict))
(else #f)))
(define (file-lock:certificate path)
@@ -165,13 +165,13 @@
(define at (substring? "@" email))
(let ((user (substring email 0 at))
(hostname (substring email (+ 1 at) (string-length email)))
- (oport (open-file lockpath "wb")))
+ (oport (open-file lockpath 'wb)))
(define userlen (string-length user))
(and oport (call-with-open-ports
oport (lambda (oport)
(define pos 1)
(define (nulls cnt)
- (display (make-bytes cnt 0) oport)
+ (write-bytes (make-bytes cnt 0) cnt oport)
(set! pos (+ cnt pos)))
(define (write-field field)
(define len (string-length field))
@@ -227,7 +227,8 @@
(case (software-type)
((UNIX COHERENT PLAN9)
;; file-system may not support symbolic links.
- (or (emacs:lock! path email) wl))
+ (or (and (provided? 'current-time) (emacs:lock! path email))
+ wl))
(else wl)))))
;;@body
@@ -434,7 +435,7 @@
(sscanf line " Workstation Domain %s" workgroup)
(sscanf line " Workgroup %s" workgroup)
(sscanf line " User name %s" user)))))))
-
+
(and netdir (not (and user hostname))
(set! netdir (string-append netdir "\\system.ini"))
(file-exists? netdir)