diff options
author | knu <knu@FreeBSD.org> | 2002-03-18 11:13:33 +0000 |
---|---|---|
committer | knu <knu@FreeBSD.org> | 2002-03-18 11:13:33 +0000 |
commit | 7946383043a99d6c49d37abb276828dde02d26a3 (patch) | |
tree | 6cc36c949ba65aad8b906dc9b307a2c0285a7d89 /converters/iconv | |
parent | 026a17e7689e8fc5790c285bdc616c1a1dd62c97 (diff) | |
download | FreeBSD-ports-7946383043a99d6c49d37abb276828dde02d26a3.zip FreeBSD-ports-7946383043a99d6c49d37abb276828dde02d26a3.tar.gz |
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>
Diffstat (limited to 'converters/iconv')
-rw-r--r-- | converters/iconv/Makefile | 2 | ||||
-rw-r--r-- | converters/iconv/files/patch-lib::converter.c | 55 |
2 files changed, 56 insertions, 1 deletions
diff --git a/converters/iconv/Makefile b/converters/iconv/Makefile index f1840e4..f449862 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 0000000..3622467 --- /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; + } + |