Displaying 1 result from an estimated 1 matches for "are_errors_suppressed".
2020 May 07
1
[PATCH nbdkit] vddk: Suppress errors in can_extents test (RHBZ#1709211).
...static void
+set_error_suppression (void)
+{
+  static const int one = 1; /* Something that gives us a non-NULL pointer. */
+  pthread_setspecific (error_suppression, &one);
+}
+
+static void
+clear_error_suppression (void)
+{
+  pthread_setspecific (error_suppression, NULL);
+}
+
+static bool
+are_errors_suppressed (void)
+{
+  return pthread_getspecific (error_suppression) != NULL;
+}
+
 /* Turn error messages from the library into nbdkit_error. */
 static void
 error_function (const char *fs, va_list args)
 {
   CLEANUP_FREE char *str = NULL;
 
+  if (are_errors_suppressed ()) return;
+
   if (vasprintf (&a...