summaryrefslogtreecommitdiffstats
path: root/transact.scm
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:31 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:31 -0800
commit5145dd3aa0c02c9fc496d1432fc4410674206e1d (patch)
tree540afc30c51da085f5bd8ec3f4c89f6496e7900d /transact.scm
parent8466d8cfa486fb30d1755c4261b781135083787b (diff)
downloadslib-5145dd3aa0c02c9fc496d1432fc4410674206e1d.tar.gz
slib-5145dd3aa0c02c9fc496d1432fc4410674206e1d.zip
Import Upstream version 3a2upstream/3a2
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)