summaryrefslogtreecommitdiff
path: root/converters
diff options
context:
space:
mode:
authorAkinori MUSHA <knu@FreeBSD.org>2002-03-18 11:13:33 +0000
committerAkinori MUSHA <knu@FreeBSD.org>2002-03-18 11:13:33 +0000
commitdc2cf7c4bcbf813c9744705b37346b1c0da6f0a3 (patch)
treef052a2b041d3bc1eefed9d99430085d5d83f04c6 /converters
parentBump PORTREVISION to reflect the (lib)iconv upgrade. (diff)
Add a patch to fix a bug where iconv() did not return -1 properly on
conversion error. This fixes null conversion and all the case where errno is set. Bump PORTREVISION. Approved by: Konstantin Chuguev <Konstantin.Chuguev@dante.org.uk> (MAINTAINER, Author) Reported by: Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
Notes
Notes: svn path=/head/; revision=56292
Diffstat (limited to 'converters')
-rw-r--r--converters/iconv/Makefile2
-rw-r--r--converters/iconv/files/patch-lib::converter.c55
2 files changed, 56 insertions, 1 deletions
diff --git a/converters/iconv/Makefile b/converters/iconv/Makefile
index f1840e47df97..f44986254571 100644
--- a/converters/iconv/Makefile
+++ b/converters/iconv/Makefile
@@ -7,7 +7,7 @@
PORTNAME= iconv
PORTVERSION= 2.0
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= converters
MASTER_SITES= http://www.dante.net/staff/konstantin/FreeBSD/iconv/
diff --git a/converters/iconv/files/patch-lib::converter.c b/converters/iconv/files/patch-lib::converter.c
new file mode 100644
index 000000000000..362246793dca
--- /dev/null
+++ b/converters/iconv/files/patch-lib::converter.c
@@ -0,0 +1,55 @@
+--- lib/converter.c.orig Sun Nov 26 22:10:22 2000
++++ lib/converter.c Mon Mar 18 19:49:56 2002
+@@ -92,14 +92,14 @@
+ if (ch == UCS_CHAR_NONE) {
+ /* Incomplete character in input buffer */
+ errno = EINVAL;
+- return res;
++ return (size_t)(-1);
+ }
+ if (ch == UCS_CHAR_INVALID) {
+ /* Invalid character in source buffer */
+ *inbytesleft += *inbuf - ptr;
+ *inbuf = ptr;
+ errno = EILSEQ;
+- return res;
++ return (size_t)(-1);
+ }
+ size = ICONV_CES_CONVERT_FROM_UCS(&(uc->to), ch,
+ outbuf, outbytesleft);
+@@ -116,7 +116,7 @@
+ *inbytesleft += *inbuf - ptr;
+ *inbuf = ptr;
+ errno = E2BIG;
+- return res;
++ return (size_t)(-1);
+ }
+ }
+ return res;
+@@ -156,14 +156,24 @@
+ {
+ if (inbuf && *inbuf && inbytesleft && *inbytesleft > 0 && outbuf
+ && *outbuf && outbytesleft && *outbytesleft > 0) {
+- size_t len = *inbytesleft < *outbytesleft ? *inbytesleft
+- : *outbytesleft;
++ size_t result, len;
++ if (*inbytesleft < *outbytesleft) {
++ result = 0;
++ len = *inbytesleft;
++ } else {
++ result = (size_t)(-1);
++ errno = E2BIG;
++ len = *outbytesleft;
++ }
+ bcopy(*inbuf, *outbuf, len);
+ *inbuf += len;
+ *inbytesleft -= len;
+ *outbuf += len;
+ *outbytesleft -= len;
++
++ return result;
+ }
++
+ return 0;
+ }
+