Date: Sat, 9 Nov 2013 22:12:51 +0200 From: Konstantin Belousov <kostikbel@gmail.com> To: Gleb Smirnoff <glebius@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r257888 - in head: contrib/smbfs/lib/smb usr.sbin/mount_smbfs Message-ID: <20131109201251.GE59496@kib.kiev.ua> In-Reply-To: <201311091448.rA9EmobU009784@svn.freebsd.org> References: <201311091448.rA9EmobU009784@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--93YajNakfnXM5q4m Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 09, 2013 at 02:48:50PM +0000, Gleb Smirnoff wrote: > Author: glebius > Date: Sat Nov 9 14:48:50 2013 > New Revision: 257888 > URL: http://svnweb.freebsd.org/changeset/base/257888 >=20 > Log: > Use system libiconv, instead of trying to dlopen() it. > =20 > PR: 183153 > Submitted by: Dominic Fandrey <kamikaze bsdforen.de> >=20 > Modified: > head/contrib/smbfs/lib/smb/nls.c > head/usr.sbin/mount_smbfs/Makefile >=20 > Modified: head/contrib/smbfs/lib/smb/nls.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=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/contrib/smbfs/lib/smb/nls.c Sat Nov 9 14:46:24 2013 (r257887) > +++ head/contrib/smbfs/lib/smb/nls.c Sat Nov 9 14:48:50 2013 (r257888) > @@ -36,12 +36,9 @@ > __FBSDID("$FreeBSD$"); > =20 > #include <sys/types.h> > -#include <sys/iconv.h> > +#include <iconv.h> > #include <sys/sysctl.h> > #include <ctype.h> > -#ifndef APPLE > -#include <dlfcn.h> > -#endif > #include <errno.h> > #include <stdio.h> > #include <string.h> > @@ -50,21 +47,10 @@ __FBSDID("$FreeBSD$"); > #include <err.h> > #include <netsmb/smb_lib.h> > =20 > -/* > - * prototype iconv* functions > - */ > -typedef void *iconv_t; > - > -static iconv_t (*my_iconv_open)(const char *, const char *); > -static size_t(*my_iconv)(iconv_t, const char **, size_t *, char **, size= _t *); > -static int(*my_iconv_close)(iconv_t); > - > u_char nls_lower[256]; > u_char nls_upper[256]; > =20 > static iconv_t nls_toext, nls_toloc; > -static int iconv_loaded; > -static void *iconv_lib; > =20 > int > nls_setlocale(const char *name) > @@ -90,32 +76,18 @@ nls_setrecode(const char *local, const c > #else > iconv_t icd; > =20 > - if (iconv_loaded =3D=3D 2) > - return ENOENT; > - else if (iconv_loaded =3D=3D 0) { > - iconv_loaded++; > - iconv_lib =3D dlopen("libiconv.so", RTLD_LAZY | RTLD_GLOBAL); > - if (iconv_lib =3D=3D NULL) { > - warn("Unable to load iconv library: %s\n", dlerror()); > - iconv_loaded++; > - return ENOENT; > - } > - my_iconv_open =3D dlsym(iconv_lib, "iconv_open"); > - my_iconv =3D dlsym(iconv_lib, "iconv"); > - my_iconv_close =3D dlsym(iconv_lib, "iconv_close"); > - } > if (nls_toext) > - my_iconv_close(nls_toext); > + iconv_close(nls_toext); > if (nls_toloc) > - my_iconv_close(nls_toloc); > + iconv_close(nls_toloc); > nls_toext =3D nls_toloc =3D (iconv_t)0; > - icd =3D my_iconv_open(external, local); > + icd =3D iconv_open(external, local); > if (icd =3D=3D (iconv_t)-1) > return errno; > nls_toext =3D icd; > - icd =3D my_iconv_open(local, external); > + icd =3D iconv_open(local, external); > if (icd =3D=3D (iconv_t)-1) { > - my_iconv_close(nls_toext); > + iconv_close(nls_toext); > nls_toext =3D (iconv_t)0; > return errno; > } > @@ -130,14 +102,11 @@ nls_str_toloc(char *dst, const char *src > char *p =3D dst; > size_t inlen, outlen; > =20 > - if (!iconv_loaded) > - return strcpy(dst, src); > - > if (nls_toloc =3D=3D (iconv_t)0) > return strcpy(dst, src); > inlen =3D outlen =3D strlen(src); > - my_iconv(nls_toloc, NULL, NULL, &p, &outlen); > - while (my_iconv(nls_toloc, &src, &inlen, &p, &outlen) =3D=3D -1) { > + iconv(nls_toloc, NULL, NULL, &p, &outlen); > + while (iconv(nls_toloc, &src, &inlen, &p, &outlen) =3D=3D -1) { > *p++ =3D *src++; > inlen--; > outlen--; > @@ -152,14 +121,11 @@ nls_str_toext(char *dst, const char *src > char *p =3D dst; > size_t inlen, outlen; > =20 > - if (!iconv_loaded) > - return strcpy(dst, src); > - > if (nls_toext =3D=3D (iconv_t)0) > return strcpy(dst, src); > inlen =3D outlen =3D strlen(src); > - my_iconv(nls_toext, NULL, NULL, &p, &outlen); > - while (my_iconv(nls_toext, &src, &inlen, &p, &outlen) =3D=3D -1) { > + iconv(nls_toext, NULL, NULL, &p, &outlen); > + while (iconv(nls_toext, &src, &inlen, &p, &outlen) =3D=3D -1) { > *p++ =3D *src++; > inlen--; > outlen--; > @@ -175,17 +141,14 @@ nls_mem_toloc(void *dst, const void *src > const char *s =3D src; > size_t inlen, outlen; > =20 > - if (!iconv_loaded) > - return memcpy(dst, src, size); > - > if (size =3D=3D 0) > return NULL; > =20 > if (nls_toloc =3D=3D (iconv_t)0) > return memcpy(dst, src, size); > inlen =3D outlen =3D size; > - my_iconv(nls_toloc, NULL, NULL, &p, &outlen); > - while (my_iconv(nls_toloc, &s, &inlen, &p, &outlen) =3D=3D -1) { > + iconv(nls_toloc, NULL, NULL, &p, &outlen); > + while (iconv(nls_toloc, &s, &inlen, &p, &outlen) =3D=3D -1) { > *p++ =3D *s++; > inlen--; > outlen--; > @@ -203,12 +166,12 @@ nls_mem_toext(void *dst, const void *src > if (size =3D=3D 0) > return NULL; > =20 > - if (!iconv_loaded || nls_toext =3D=3D (iconv_t)0) > + if (nls_toext =3D=3D (iconv_t)0) > return memcpy(dst, src, size); > =20 > inlen =3D outlen =3D size; > - my_iconv(nls_toext, NULL, NULL, &p, &outlen); > - while (my_iconv(nls_toext, &s, &inlen, &p, &outlen) =3D=3D -1) { > + iconv(nls_toext, NULL, NULL, &p, &outlen); > + while (iconv(nls_toext, &s, &inlen, &p, &outlen) =3D=3D -1) { > *p++ =3D *s++; > inlen--; > outlen--; >=20 > Modified: head/usr.sbin/mount_smbfs/Makefile > =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=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/usr.sbin/mount_smbfs/Makefile Sat Nov 9 14:46:24 2013 (r257887) > +++ head/usr.sbin/mount_smbfs/Makefile Sat Nov 9 14:48:50 2013 (r257888) > @@ -11,11 +11,6 @@ CFLAGS+=3D -DSMBFS -I${MOUNTDIR} -I${CONTR > LDADD=3D -lsmb -lkiconv > DPADD=3D ${LIBSMB} ${LIBKICONV} > =20 > -# Needs to be dynamically linked for optional dlopen() access to > -# userland libiconv (see the -E option). > -# > -NO_SHARED?=3D NO > - > .PATH: ${CONTRIBDIR}/mount_smbfs > .PATH: ${MOUNTDIR} > =20 This breaks WITHOUT_ICONV. --93YajNakfnXM5q4m Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQIcBAEBAgAGBQJSfpdCAAoJEJDCuSvBvK1BZ8oP/RKuqE3yVOtngQPtRoR+KZ+l X19Mqb4QLbIilQ1r7H3sbbIElekXXRkSKR8ke05mQh0q5zZFDuXmmq2XYjnr2Lqo +fqc1iySNk1tj+eijovbbbAbPZS3Wt1l4cm90Re85m98BxcW9Hlg5pXcKLCs2qZl /z1iSEV2+Bje/GibtS03iodcMtl+p0mo3tH6lUXqmSnyXfdHYP5UIiWjXljofBeM 4v8hB7vPJcJBY2pvV5NEq1hv1/EqrfEOpZ/c99/X0pOE2LjVUbyhx+LheXJAqEyK nRHBnrj052jtvl7FSkqg9RyCMCMllxaMg0hwe1A5MwmzaGMOeLDSCQ2GFv7GU/pH fIM9/m9uOzIjVPax9NSnhNV5eSg97hf3ZStMUuzo2JC6Kszs0FJvdtw5SdQv+cf4 IAiiChIAw/0G2N9OBh133mjcMVOUhCmL0tbQ16h6fXkK5QJiD2FieLMHrOTW0DU/ gr3z3nQ6QgiT6rW0KumK79auXf1KZD1RM+MFHtIxJ2W5ReauYF4DiakoRvpIIlJz BTtkkkW1lv0y9uVoLATIcqPIw4C3BcxMDRdI2EbJ10JZJTcKnuh7EjI67Nf3FYzU qDEeZd4M3RItQjZAWXEcOjUOH+xOjcCBBwHVGrkq1AZgRY3ghY8bnU9z7ugYjr8D jDX4we+nhYNzmrvIsq4J =/c/i -----END PGP SIGNATURE----- --93YajNakfnXM5q4m--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131109201251.GE59496>