diff options
author | Jeremy Allison <jra@samba.org> | 2004-04-01 19:42:36 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2004-04-01 19:42:36 +0000 |
commit | fe160f5b723b6ac08552d918e80aa85ce974d876 (patch) | |
tree | 50ebf6746e6e7c7d097ba57f7f6f025d9cf7c45e | |
parent | 2197bd26ac1809ca0cee42036c594a97dabe681e (diff) | |
download | samba-fe160f5b723b6ac08552d918e80aa85ce974d876.tar.gz samba-fe160f5b723b6ac08552d918e80aa85ce974d876.tar.bz2 samba-fe160f5b723b6ac08552d918e80aa85ce974d876.zip |
"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)
-rw-r--r-- | source3/lib/charcnv.c | 18 |
1 files changed, 14 insertions, 4 deletions
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; } |