From: Andreas Fuchs Date: Sun, 7 Oct 2007 11:00:33 +0000 (+0000) Subject: 1.0.10.34: Fix sb-posix:get{{gr,pw}nam},pwuid,grgid} for non-existing entries. X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=2abe57fab08f09e167f7abad410f8ad4fd120a57;p=sbcl.git 1.0.10.34: Fix sb-posix:get{{gr,pw}nam},pwuid,grgid} for non-existing entries. Used to signal memory fault, now returns NIL on queries for non-existing users or groups. --- diff --git a/contrib/sb-posix/interface.lisp b/contrib/sb-posix/interface.lisp index 7bc574b..cef0c71 100644 --- a/contrib/sb-posix/interface.lisp +++ b/contrib/sb-posix/interface.lisp @@ -397,8 +397,8 @@ (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)) @@ -420,8 +420,8 @@ (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)) diff --git a/contrib/sb-posix/posix-tests.lisp b/contrib/sb-posix/posix-tests.lisp index 9f74b51..03568d6 100644 --- a/contrib/sb-posix/posix-tests.lisp +++ b/contrib/sb-posix/posix-tests.lisp @@ -467,6 +467,14 @@ 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)) @@ -478,6 +486,14 @@ (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 diff --git a/version.lisp-expr b/version.lisp-expr index 3913ebc..21ef660 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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"