From owner-svn-src-all@FreeBSD.ORG Thu Dec 22 18:33:37 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20EB0106566B; Thu, 22 Dec 2011 18:33:37 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 711EE8FC19; Thu, 22 Dec 2011 18:33:34 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 87E546DEF; Thu, 22 Dec 2011 18:33:30 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 68A5281D2; Thu, 22 Dec 2011 19:33:30 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Gleb Smirnoff References: <201112221810.pBMIAFlo028054@svn.freebsd.org> <20111222182219.GS80057@FreeBSD.org> <86bor0sbra.fsf@ds4.des.no> Date: Thu, 22 Dec 2011 19:33:30 +0100 In-Reply-To: <86bor0sbra.fsf@ds4.des.no> ("Dag-Erling =?utf-8?Q?Sm=C3=B8rg?= =?utf-8?Q?rav=22's?= message of "Thu, 22 Dec 2011 19:27:05 +0100") Message-ID: <867h1osbgl.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-vendor@FreeBSD.org Subject: Re: svn commit: r228809 - vendor/openpam/dist/lib X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2011 18:33:37 -0000 Actually, there is no good general solution, because the rtld does not set errno. Here's what I came up with: Index: openpam_dynamic.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- openpam_dynamic.c (revision 509) +++ openpam_dynamic.c (working copy) @@ -63,10 +63,15 @@ static void * try_dlopen(const char *modfn) { + void *dlh; =20 if (openpam_check_path_owner_perms(modfn) !=3D 0) return (NULL); - return (dlopen(modfn, RTLD_NOW)); + if ((dlh =3D dlopen(modfn, RTLD_NOW)) =3D=3D NULL) { + openpam_log(PAM_LOG_DEBUG, "%s: %s", modfn, dlerror()); + errno =3D 0; + } + return (dlh); } =20=20=20=20=20 /* @@ -124,7 +129,8 @@ dlclose(dlh); FREE(module); err: - openpam_log(PAM_LOG_ERROR, "%m"); + if (errno !=3D 0) + openpam_log(PAM_LOG_ERROR, "%s: %m", path); return (NULL); } =20 I'll wait for your feedback before I commit it. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no