Print this page
2249 libbrand suppresses libxml2 errors
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Eric Shrock <eric.schrock@delphix.com>
Reviewed by: Milan Jurik <milan.jurik@xylab.cz>

@@ -19,10 +19,11 @@
  * CDDL HEADER END
  */
 
 /*
  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012 Nexenta Systems, Inc.  All rights reserved.
  */
 
 #include <assert.h>
 #include <dirent.h>
 #include <errno.h>

@@ -100,17 +101,28 @@
 static char                     i_curr_arch[MAXNAMELEN];
 static char                     i_curr_zone[ZONENAME_MAX];
 
 /*ARGSUSED*/
 static void
-brand_error_func(void *ctx, const char *msg, ...)
+brand_warning_func(void *ctx, const char *msg, ...)
 {
         /*
-         * Ignore error messages from libxml
+         * Ignore warning messages from libxml
          */
 }
 
+/*ARGSUSED*/
+static void
+brand_error_func(void *ctx, const char *msg, ...)
+{
+        va_list args;
+
+        va_start(args, msg);
+        (void) vfprintf(stderr, msg, args);
+        va_end(args);
+}
+
 static boolean_t
 libbrand_initialize()
 {
         static mutex_t initialize_lock = DEFAULTMUTEX;
 

@@ -200,11 +212,11 @@
         if ((cvp = xmlNewValidCtxt()) == NULL) {
                 xmlFreeDoc(doc);
                 return (NULL);
         }
         cvp->error = brand_error_func;
-        cvp->warning = brand_error_func;
+        cvp->warning = brand_warning_func;
         valid = xmlValidateDocument(cvp, doc);
         xmlFreeValidCtxt(cvp);
         if (valid == 0) {
                 xmlFreeDoc(doc);
                 return (NULL);