lib: param: Use utility functions to get rid of two more uses of global_iconv_handle.
authorJeremy Allison <jra@samba.org>
Tue, 11 Apr 2017 22:51:17 +0000 (15:51 -0700)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 18 Apr 2017 09:47:17 +0000 (11:47 +0200)
Add error return checking.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
lib/param/loadparm.c

index 5f9d52b2bd78305cdd5c533b87e286209004cae7..5b5543c4a2a742a5efc88a907e5240aa4e603e7a 100644 (file)
@@ -1265,11 +1265,14 @@ bool handle_charset(struct loadparm_context *lp_ctx, struct loadparm_service *se
 {
        if (lp_ctx->s3_fns) {
                if (*ptr == NULL || strcmp(*ptr, pszParmValue) != 0) {
-                       global_iconv_handle =
-                               smb_iconv_handle_reinit(NULL,
-                                                       lpcfg_dos_charset(lp_ctx),
-                                                       lpcfg_unix_charset(lp_ctx),
-                                                       true, global_iconv_handle);
+                       struct smb_iconv_handle *ret = NULL;
+
+                       ret = reinit_iconv_handle(NULL,
+                                                 lpcfg_dos_charset(lp_ctx),
+                                                 lpcfg_unix_charset(lp_ctx));
+                       if (ret == NULL) {
+                               smb_panic("reinit_iconv_handle failed");
+                       }
                }
 
        }
@@ -1304,16 +1307,19 @@ bool handle_dos_charset(struct loadparm_context *lp_ctx, struct loadparm_service
                }
 
                if (*ptr == NULL || strcmp(*ptr, pszParmValue) != 0) {
+                       struct smb_iconv_handle *ret = NULL;
                        if (is_utf8) {
                                DEBUG(0,("ERROR: invalid DOS charset: 'dos charset' must not "
                                        "be UTF8, using (default value) %s instead.\n",
                                        DEFAULT_DOS_CHARSET));
                                pszParmValue = DEFAULT_DOS_CHARSET;
                        }
-                       global_iconv_handle = smb_iconv_handle_reinit(NULL,
-                                                       lpcfg_dos_charset(lp_ctx),
-                                                       lpcfg_unix_charset(lp_ctx),
-                                                       true, global_iconv_handle);
+                       ret = reinit_iconv_handle(NULL,
+                                               lpcfg_dos_charset(lp_ctx),
+                                               lpcfg_unix_charset(lp_ctx));
+                       if (ret == NULL) {
+                               smb_panic("reinit_iconv_handle failed");
+                       }
                }
        }