[osicat-cvs] CVS update: src/ffi.lisp src/osicat.lisp

Update of /project/osicat/cvsroot/src In directory common-lisp.net:/tmp/cvs-serv20175 Modified Files: ffi.lisp osicat.lisp Log Message: Updated MAKE-TEMPORARY-FILE to unlink temporary file when not using tmpfile(3). Date: Fri Jul 8 16:18:19 2005 Author: jsquires Index: src/ffi.lisp diff -u src/ffi.lisp:1.4 src/ffi.lisp:1.5 --- src/ffi.lisp:1.4 Tue Jul 5 18:55:46 2005 +++ src/ffi.lisp Fri Jul 8 16:18:19 2005 @@ -137,4 +137,8 @@ (def-function "tmpnam" ((template :cstring)) :module "osicat" - :returning :cstring) \ No newline at end of file + :returning :cstring) + +(def-function "unlink" ((pathname :cstring)) + :module "osicat" + :returning :int) Index: src/osicat.lisp diff -u src/osicat.lisp:1.33 src/osicat.lisp:1.34 --- src/osicat.lisp:1.33 Tue Jul 5 19:48:12 2005 +++ src/osicat.lisp Fri Jul 8 16:18:19 2005 @@ -148,10 +148,14 @@ :element-type element-type)) ;; XXX Warn about insecurity? Or is any platform too dumb to have ;; fds, also relatively safe from race conditions through obscurity? - ;; XXX Another bug with this: the file doesn't get unlinked. + ;; XXX Will unlinking the file after opening the stream work the way + ;; we expect? #-(or cmu sbcl) - (open (convert-from-cstring (tmpnam (make-null-pointer 'cstring))) - :direction :io :element-type element-type)) + (let* ((name (tmpnam (make-null-pointer 'cstring))) + (stream (open (convert-from-cstring name) :direction :io + :element-type element-type))) + (unlink name) + stream)) (defmacro with-temporary-file ((stream &key element-type) &body body)
participants (1)
-
jsquires@common-lisp.net