sb-bsd-sockets: less SERVE-EVENT
[sbcl.git] / contrib / sb-bsd-sockets / name-service.lisp
index ff9279b..165c215 100644 (file)
@@ -20,7 +20,7 @@
   (car (host-ent-addresses host-ent)))
 
 (defun make-host-ent (h &optional errno)
-  (when (sb-grovel::foreign-nullp h)
+  (when (sb-alien:null-alien h)
     (name-service-error "gethostbyname" errno))
   (let* ((length (sockint::hostent-length h))
          (aliases (loop for i = 0 then (1+ i)
@@ -35,7 +35,7 @@
                           (#.sockint::af-inet
                            ;; CLH: Work around x86-64 darwin bug here.
                            ;; The length is reported as 8, when it should be 4.
-                           ;; FIXME: this is rumored to be fix in 10.5
+                           ;; FIXME: this is rumored to be fixed in 10.5
                            #+(and darwin x86-64)
                            (progn
                              (assert (or (= length 4) (= length 8)))
@@ -125,6 +125,7 @@ weird stuff - see gethostbyname(3) or getaddrinfo(3) for the details."
   (assert (= (length address) 4))
   (sockint::with-sockaddr-in sockaddr ()
     (sb-alien:with-alien ((host-buf (array char #.ni-max-host)))
+      #+darwin (setf (sockint::sockaddr-in-len sockaddr) 16)
       (setf (sockint::sockaddr-in-family sockaddr) sockint::af-inet)
       (dotimes (i 4)
         (setf (sb-alien:deref (sockint::sockaddr-in-addr sockaddr) i)
@@ -169,7 +170,7 @@ GET-NAME-SERVICE-ERRNO")
   (let ((condition (condition-for-name-service-error-code error-code)))
     (error condition :error-code error-code :syscall where)))
 
-(define-condition name-service-error (condition)
+(define-condition name-service-error (error)
   ((errno :initform nil :initarg :errno :reader name-service-error-errno)
    (error-code :initform nil :initarg :error-code
                :reader name-service-error-error-code)
@@ -229,8 +230,11 @@ GET-NAME-SERVICE-ERRNO")
     sockint::EAI-FAIL
     no-recovery-error)
 (define-name-service-condition
-    sockint::NO-ADDRESS  ;; Also defined as NO-DATA, with the same value
-    #-freebsd sockint::EAI-NODATA #+freebsd nil
+    ;; Also defined as NO-DATA, with the same value
+    sockint::NO-ADDRESS
+    ;; getaddrinfo() as of RFC 3493 can no longer distinguish between
+    ;; host no found and address not found
+    nil
     no-address-error)
 
 (defun condition-for-name-service-errno (err)