FreeBSD Bugzilla – Attachment 137557 Details for
Bug 183153
[patch] Fix iconv support of mount_smbfs(8)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 4.26 KB, created by
kamikaze
on 2013-10-21 12:30:00 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
kamikaze
Created:
2013-10-21 12:30:00 UTC
Size:
4.26 KB
patch
obsolete
>Index: contrib/smbfs/lib/smb/nls.c >=================================================================== >--- contrib/smbfs/lib/smb/nls.c (revision 256833) >+++ contrib/smbfs/lib/smb/nls.c (working copy) >@@ -36,12 +36,9 @@ > __FBSDID("$FreeBSD$"); > > #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 @@ > #include <err.h> > #include <netsmb/smb_lib.h> > >-/* >- * 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]; > > static iconv_t nls_toext, nls_toloc; >-static int iconv_loaded; >-static void *iconv_lib; > > int > nls_setlocale(const char *name) >@@ -90,32 +76,18 @@ > #else > iconv_t icd; > >- if (iconv_loaded == 2) >- return ENOENT; >- else if (iconv_loaded == 0) { >- iconv_loaded++; >- iconv_lib = dlopen("libiconv.so", RTLD_LAZY | RTLD_GLOBAL); >- if (iconv_lib == NULL) { >- warn("Unable to load iconv library: %s\n", dlerror()); >- iconv_loaded++; >- return ENOENT; >- } >- my_iconv_open = dlsym(iconv_lib, "iconv_open"); >- my_iconv = dlsym(iconv_lib, "iconv"); >- my_iconv_close = 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 = nls_toloc = (iconv_t)0; >- icd = my_iconv_open(external, local); >+ icd = iconv_open(external, local); > if (icd == (iconv_t)-1) > return errno; > nls_toext = icd; >- icd = my_iconv_open(local, external); >+ icd = iconv_open(local, external); > if (icd == (iconv_t)-1) { >- my_iconv_close(nls_toext); >+ iconv_close(nls_toext); > nls_toext = (iconv_t)0; > return errno; > } >@@ -130,14 +102,11 @@ > char *p = dst; > size_t inlen, outlen; > >- if (!iconv_loaded) >- return strcpy(dst, src); >- > if (nls_toloc == (iconv_t)0) > return strcpy(dst, src); > inlen = outlen = strlen(src); >- my_iconv(nls_toloc, NULL, NULL, &p, &outlen); >- while (my_iconv(nls_toloc, &src, &inlen, &p, &outlen) == -1) { >+ iconv(nls_toloc, NULL, NULL, &p, &outlen); >+ while (iconv(nls_toloc, &src, &inlen, &p, &outlen) == -1) { > *p++ = *src++; > inlen--; > outlen--; >@@ -152,14 +121,11 @@ > char *p = dst; > size_t inlen, outlen; > >- if (!iconv_loaded) >- return strcpy(dst, src); >- > if (nls_toext == (iconv_t)0) > return strcpy(dst, src); > inlen = outlen = strlen(src); >- my_iconv(nls_toext, NULL, NULL, &p, &outlen); >- while (my_iconv(nls_toext, &src, &inlen, &p, &outlen) == -1) { >+ iconv(nls_toext, NULL, NULL, &p, &outlen); >+ while (iconv(nls_toext, &src, &inlen, &p, &outlen) == -1) { > *p++ = *src++; > inlen--; > outlen--; >@@ -175,9 +141,6 @@ > const char *s = src; > size_t inlen, outlen; > >- if (!iconv_loaded) >- return memcpy(dst, src, size); >- > if (size == 0) > return NULL; > >@@ -184,8 +147,8 @@ > if (nls_toloc == (iconv_t)0) > return memcpy(dst, src, size); > inlen = outlen = size; >- my_iconv(nls_toloc, NULL, NULL, &p, &outlen); >- while (my_iconv(nls_toloc, &s, &inlen, &p, &outlen) == -1) { >+ iconv(nls_toloc, NULL, NULL, &p, &outlen); >+ while (iconv(nls_toloc, &s, &inlen, &p, &outlen) == -1) { > *p++ = *s++; > inlen--; > outlen--; >@@ -203,12 +166,12 @@ > if (size == 0) > return NULL; > >- if (!iconv_loaded || nls_toext == (iconv_t)0) >+ if (nls_toext == (iconv_t)0) > return memcpy(dst, src, size); > > inlen = outlen = size; >- my_iconv(nls_toext, NULL, NULL, &p, &outlen); >- while (my_iconv(nls_toext, &s, &inlen, &p, &outlen) == -1) { >+ iconv(nls_toext, NULL, NULL, &p, &outlen); >+ while (iconv(nls_toext, &s, &inlen, &p, &outlen) == -1) { > *p++ = *s++; > inlen--; > outlen--; >Index: usr.sbin/mount_smbfs/Makefile >=================================================================== >--- usr.sbin/mount_smbfs/Makefile (revision 256833) >+++ usr.sbin/mount_smbfs/Makefile (working copy) >@@ -11,11 +11,6 @@ > LDADD= -lsmb -lkiconv > DPADD= ${LIBSMB} ${LIBKICONV} > >-# Needs to be dynamically linked for optional dlopen() access to >-# userland libiconv (see the -E option). >-# >-NO_SHARED?= NO >- > .PATH: ${CONTRIBDIR}/mount_smbfs > .PATH: ${MOUNTDIR}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 183153
: 137557