Date: Thu, 22 Dec 2011 22:42:58 +0400 From: Gleb Smirnoff <glebius@FreeBSD.org> To: Dag-Erling Sm??rgrav <des@des.no> Cc: svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-vendor@FreeBSD.org Subject: Re: svn commit: r228809 - vendor/openpam/dist/lib Message-ID: <20111222184258.GU80057@FreeBSD.org> In-Reply-To: <867h1osbgl.fsf@ds4.des.no> References: <201112221810.pBMIAFlo028054@svn.freebsd.org> <20111222182219.GS80057@FreeBSD.org> <86bor0sbra.fsf@ds4.des.no> <867h1osbgl.fsf@ds4.des.no>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Dec 22, 2011 at 07:33:30PM +0100, Dag-Erling Sm??rgrav wrote: D> Actually, there is no good general solution, because the rtld does not D> set errno. Here's what I came up with: D> D> Index: openpam_dynamic.c D> =================================================================== D> --- openpam_dynamic.c (revision 509) D> +++ openpam_dynamic.c (working copy) D> @@ -63,10 +63,15 @@ D> static void * D> try_dlopen(const char *modfn) D> { D> + void *dlh; D> D> if (openpam_check_path_owner_perms(modfn) != 0) D> return (NULL); D> - return (dlopen(modfn, RTLD_NOW)); D> + if ((dlh = dlopen(modfn, RTLD_NOW)) == NULL) { D> + openpam_log(PAM_LOG_DEBUG, "%s: %s", modfn, dlerror()); D> + errno = 0; D> + } D> + return (dlh); D> } Why not PAM_LOG_ERROR? D> /* D> @@ -124,7 +129,8 @@ D> dlclose(dlh); D> FREE(module); D> err: D> - openpam_log(PAM_LOG_ERROR, "%m"); D> + if (errno != 0) D> + openpam_log(PAM_LOG_ERROR, "%s: %m", path); D> return (NULL); D> } I think vpath is better choice here, as explained in previous mail D> I'll wait for your feedback before I commit it. Thanks! -- Totus tuus, Glebius.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111222184258.GU80057>