Fix sb-posix:readdir for the new sb-grovel types
* readdir now returns a (* dirent), as reflected by reality
* Add test cases for readdir and opendir, too
(fcntl-without-arg fd cmd)))
(define-call "opendir" (* t) null-alien (pathname filename))
-(define-call "readdir" sb-posix::dirent
+(define-call "readdir" (* sb-posix::dirent)
;; readdir() has the worst error convention in the world. It's just
;; too painful to support. (return is NULL _and_ errno "unchanged"
;; is not an error, it's EOF).
(let ((fd (sb-posix:open "/dev/null" sb-posix::o-nonblock)))
(= (sb-posix:fcntl fd sb-posix::f-getfl) sb-posix::o-nonblock))
t)
+
+
+(deftest opendir.1
+ (let ((dir (sb-posix:opendir "/")))
+ (sb-alien:null-alien dir))
+ nil)
+
+(deftest readdir.1
+ (let ((dir (sb-posix:opendir "/")))
+ (unwind-protect
+ (block dir-loop
+ (loop for dirent = (sb-posix:readdir dir)
+ until (sb-alien:null-alien dirent)
+ when (not (stringp (sb-posix:dirent-name dirent)))
+ do (return-from dir-loop nil)
+ finally (return t)))
+ (sb-posix:closedir dir)))
+ t)
;;; checkins which aren't released. (And occasionally for internal
;;; versions, especially for internal versions off the main CVS
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.8.12.44"
+"0.8.12.45"