r7898: don't die on bad iconv libs in LOCAL-ICONV test
authorAndrew Tridgell <tridge@samba.org>
Sat, 25 Jun 2005 04:48:20 +0000 (04:48 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:18:47 +0000 (13:18 -0500)
(This used to be commit fe7055df94ecc81d6758ee7ff82534451d620d6a)

source4/torture/local/iconv.c

index e9dc3e16f80de673c1800404078175fe77a6222e..e61d3348eb89e2d5465aab643792c5ff78670131 100644 (file)
@@ -38,6 +38,10 @@ static int gen_codepoint_utf16(unsigned int codepoint,
        size_t size_in, size_out, ret;
        if (!cd) {
                cd = iconv_open("UTF-16LE", "UCS-4LE");
+               if (cd == (iconv_t)-1) {
+                       cd = NULL;
+                       return -1;
+               }
        }
 
        in[0] = codepoint & 0xFF;
@@ -123,6 +127,10 @@ static int test_buffer(uint8_t *inbuf, size_t size, const char *charset)
 
        if (!cd) {
                cd = iconv_open(charset, "UTF-16LE");
+               if (cd == (iconv_t)-1) {
+                       cd = NULL;
+                       return 0;
+               }
                cd2 = smb_iconv_open(charset, "UTF-16LE");
                cd3 = smb_iconv_open("UTF-16LE", charset);
                last_charset = charset;