Revert to revision 1.8. Blindly ignoring options is not acceptable

behavior and hides more problems than it is fixing.

Discussion:
http://mail-index.netbsd.org/current-users/2009/02/03/msg007761.html

Approved by: core@
This commit is contained in:
joerg 2009-08-05 15:17:02 +00:00
parent 0c2684fa82
commit 466a3e5dee

View File

@ -1,4 +1,4 @@
/* $NetBSD: iconv.c,v 1.11 2009/03/03 16:22:33 explorer Exp $ */
/* $NetBSD: iconv.c,v 1.12 2009/08/05 15:17:02 joerg Exp $ */
/*-
* Copyright (c)2003 Citrus Project,
@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: iconv.c,v 1.11 2009/03/03 16:22:33 explorer Exp $");
__RCSID("$NetBSD: iconv.c,v 1.12 2009/08/05 15:17:02 joerg Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -47,8 +47,6 @@ __weak_alias(iconv_close, _iconv_close)
#ifdef HAVE_CITRUS
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
#include "citrus_types.h"
#include "citrus_module.h"
#include "citrus_esdb.h"
@ -57,37 +55,14 @@ __weak_alias(iconv_close, _iconv_close)
#define ISBADF(_h_) (!(_h_) || (_h_) == (iconv_t)-1)
iconv_t
iconv_open(const char *out, const char *in)
{
int ret;
struct _citrus_iconv *handle;
char *out_truncated;
char *p;
/*
* Remove anything following a //, as these are options (like
* //ignore, //translate, etc) and we just don't handle them.
* This is for compatibilty wiht software that uses thees
* blindly.
*/
out_truncated = strdup(out);
if (out_truncated == NULL) {
errno = ENOMEM;
return ((iconv_t)-1);
}
p = out_truncated;
while (*p != 0) {
if (p[0] == '/' && p[1] == '/') {
*p = '\0';
break;
}
p++;
}
ret = _citrus_iconv_open(&handle, _PATH_ICONV, in, out_truncated);
free(out_truncated);
ret = _citrus_iconv_open(&handle, _PATH_ICONV, in, out);
if (ret) {
errno = ret == ENOENT? EINVAL : ret;
return ((iconv_t)-1);