summaryrefslogtreecommitdiffstats
path: root/lib/libc/iconv/citrus_iconv.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2013-08-08 01:53:27 +0000
committerpeter <peter@FreeBSD.org>2013-08-08 01:53:27 +0000
commit4f61f84d69eaf07fbd7587d0b731fe972ad79fdd (patch)
treec828deb2715d0685133cae289a0e086d36ebe7f9 /lib/libc/iconv/citrus_iconv.c
parent72912943141c1310b1bd87f639b993d272ec2e43 (diff)
downloadFreeBSD-src-4f61f84d69eaf07fbd7587d0b731fe972ad79fdd.zip
FreeBSD-src-4f61f84d69eaf07fbd7587d0b731fe972ad79fdd.tar.gz
Our libc iconv (unlike gnu iconv and the citrus code in NetBSD) has a
bypass mode when src == dst. Unfortunately, there are tools in ports that pass byte streams through iconv to determine if the encodings are valid. eg: gettext-0.18.3+. Disable the optimization and behave like the other implementations.
Diffstat (limited to 'lib/libc/iconv/citrus_iconv.c')
-rw-r--r--lib/libc/iconv/citrus_iconv.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/libc/iconv/citrus_iconv.c b/lib/libc/iconv/citrus_iconv.c
index 31cf7df..e4bd24f 100644
--- a/lib/libc/iconv/citrus_iconv.c
+++ b/lib/libc/iconv/citrus_iconv.c
@@ -116,7 +116,20 @@ open_shared(struct _citrus_iconv_shared * __restrict * __restrict rci,
size_t len_convname;
int ret;
+#ifdef INCOMPATIBLE_WITH_GNU_ICONV
+ /*
+ * Sadly, the gnu tools expect iconv to actually parse the
+ * byte stream and don't allow for a pass-through when
+ * the (src,dest) encodings are the same.
+ * See gettext-0.18.3+ NEWS:
+ * msgfmt now checks PO file headers more strictly with less
+ * false-positives.
+ * NetBSD don't do this either.
+ */
module = (strcmp(src, dst) != 0) ? "iconv_std" : "iconv_none";
+#else
+ module = "iconv_std";
+#endif
/* initialize iconv handle */
len_convname = strlen(convname);
OpenPOWER on IntegriCloud