From fe160f5b723b6ac08552d918e80aa85ce974d876 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 1 Apr 2004 19:42:36 +0000 Subject: "Fixing my FORTRAN". Ensure we always have some valid char converter for the neccessary types before we will run at all. If we can't get one, use ASCII but complain mightily. Jeremy. (This used to be commit 37dd5e52f61e7ba1facb726ac70fc75e22608103) --- source3/lib/charcnv.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'source3') diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c index 11b1448f1e..b9791931a3 100644 --- a/source3/lib/charcnv.c +++ b/source3/lib/charcnv.c @@ -130,9 +130,21 @@ void init_iconv(void) conv_handles[c1][c2] = smb_iconv_open(n2,n1); if (conv_handles[c1][c2] == (smb_iconv_t)-1) { - DEBUG(0,("Conversion from %s to %s not supported\n", + DEBUG(0,("init_iconv: Conversion from %s to %s not supported\n", charset_name((charset_t)c1), charset_name((charset_t)c2))); - conv_handles[c1][c2] = NULL; + if (c1 != CH_UCS2) { + n1 = "ASCII"; + } + if (c2 != CH_UCS2) { + n2 = "ASCII"; + } + DEBUG(0,("init_iconv: Attempting to replace with conversion from %s to %s\n", + n1, n2 )); + conv_handles[c1][c2] = smb_iconv_open(n2,n1); + if (!conv_handles[c1][c2]) { + DEBUG(0,("init_iconv: Conversion from %s to %s failed", n1, n2)); + smb_panic("init_iconv: conv_handle initialization failed."); + } } } } @@ -477,8 +489,6 @@ size_t convert_string_allocate(TALLOC_CTX *ctx, charset_t from, charset_t to, if (descriptor == (smb_iconv_t)-1 || descriptor == (smb_iconv_t)0) { if (!conv_silent) DEBUG(0,("convert_string_allocate: Conversion not supported.\n")); - if (allow_bad_conv) - goto use_as_is; return (size_t)-1; } -- cgit