1.0.10.34: Fix sb-posix:get{{gr,pw}nam},pwuid,grgid} for non-existing entries.
authorAndreas Fuchs <asf@boinkor.net>
Sun, 7 Oct 2007 11:00:33 +0000 (11:00 +0000)
committerAndreas Fuchs <asf@boinkor.net>
Sun, 7 Oct 2007 11:00:33 +0000 (11:00 +0000)
Used to signal memory fault, now returns NIL on queries for non-existing
users or groups.

contrib/sb-posix/interface.lisp
contrib/sb-posix/posix-tests.lisp
version.lisp-expr

index 7bc574b..cef0c71 100644 (file)
       (declaim (inline ,lisp-name))
       (defun ,lisp-name (,arg)
         (let ((r (alien-funcall (extern-alien ,name ,type) ,arg)))
-          (if (null r)
-              r
+          (if (null-alien r)
+              nil
               (alien-to-passwd r)))))))
 
 (define-pw-call "getpwnam" login-name (function (* alien-passwd) c-string))
       (declaim (inline ,lisp-name))
       (defun ,lisp-name (,arg)
         (let ((r (alien-funcall (extern-alien ,name ,type) ,arg)))
-          (if (null r)
-              r
+          (if (null-alien r)
+              nil
               (alien-to-group r)))))))
 
 (define-gr-call "getgrnam" login-name (function (* alien-group) c-string))
index 9f74b51..03568d6 100644 (file)
   nil)
 
 #-win32
+(deftest pwent.non-existing
+    ;; make sure that we get something sensible, not an error
+    (handler-case (progn (sb-posix:getpwnam "almost-certainly-does-not-exist")
+                         nil)
+      (t (cond) t))
+  nil)
+
+#-win32
 (deftest grent.1
   ;; make sure that we found something
   (not (sb-posix:getgrgid 0))
   (not (sb-posix:getgrnam "wheel"))
   nil)
 
+#-win32
+(deftest grent.non-existing
+    ;; make sure that we get something sensible, not an error
+    (handler-case (progn (sb-posix:getgrnam "almost-certainly-does-not-exist")
+                         nil)
+      (t (cond) t))
+  nil)
+
 #+nil
 ;; Requires root or special group + plus a sensible thing on the port
 (deftest cfget/setispeed.1
index 3913ebc..21ef660 100644 (file)
@@ -17,4 +17,4 @@
 ;;; 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".)
-"1.0.10.33"
+"1.0.10.34"