Commit dc6578ab6072064b0a9ee7ab9e96520f0f28c0cc

Thomas de Grivel 2018-06-15T10:43:44

shadow probe-file using unistd:c-open

diff --git a/package.lisp b/package.lisp
index 66524ca..e913988 100644
--- a/package.lisp
+++ b/package.lisp
@@ -31,6 +31,7 @@
    :html-entities
    :str
    :unistd-stream)
+  (:shadow #:probe-file)
   #.(cl-stream:shadowing-import-from)
   (:export
    #:request
diff --git a/thot.lisp b/thot.lisp
index 4a615b4..b3b6db0 100644
--- a/thot.lisp
+++ b/thot.lisp
@@ -388,6 +388,12 @@ The requested url "
       (dirent:closedir dirp)
       t)))
 
+(defun probe-file (path)
+  (let ((filep (fcntl:c-open/2 path fcntl:+o-rdonly+)))
+    (unless (< filep 0)
+      (unistd:close filep)
+      t)))
+
 (defun prefix-p (pre str)
   (declare (type simple-string pre str))
   (and (<= (length pre) (length str))