From cf5db0a418b63d71385b43897a7ea9be7bb785d1 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Sat, 28 Apr 2012 16:50:00 -0700 Subject: [PATCH] darwin: Make reported errors more user-friendly Signed-off-by: Jeremy Huddleston --- src/glx/apple/apple_glx_drawable.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/glx/apple/apple_glx_drawable.c b/src/glx/apple/apple_glx_drawable.c index db283023a63..3f84d560c53 100644 --- a/src/glx/apple/apple_glx_drawable.c +++ b/src/glx/apple/apple_glx_drawable.c @@ -32,6 +32,7 @@ #include #include #include +#include #include "apple_glx.h" #include "apple_glx_context.h" #include "apple_glx_drawable.h" @@ -48,8 +49,8 @@ lock_drawables_list(void) err = pthread_mutex_lock(&drawables_lock); if (err) { - fprintf(stderr, "pthread_mutex_lock failure in %s: %d\n", - __func__, err); + fprintf(stderr, "pthread_mutex_lock failure in %s: %s\n", + __func__, strerror(err)); abort(); } } @@ -62,8 +63,8 @@ unlock_drawables_list(void) err = pthread_mutex_unlock(&drawables_lock); if (err) { - fprintf(stderr, "pthread_mutex_unlock failure in %s: %d\n", - __func__, err); + fprintf(stderr, "pthread_mutex_unlock failure in %s: %s\n", + __func__, strerror(err)); abort(); } } @@ -95,7 +96,7 @@ drawable_lock(struct apple_glx_drawable *agd) err = pthread_mutex_lock(&agd->mutex); if (err) { - fprintf(stderr, "pthread_mutex_lock error: %d\n", err); + fprintf(stderr, "pthread_mutex_lock error: %s\n", strerror(err)); abort(); } } @@ -108,7 +109,7 @@ drawable_unlock(struct apple_glx_drawable *d) err = pthread_mutex_unlock(&d->mutex); if (err) { - fprintf(stderr, "pthread_mutex_unlock error: %d\n", err); + fprintf(stderr, "pthread_mutex_unlock error: %s\n", strerror(err)); abort(); } } @@ -245,7 +246,7 @@ common_init(Display * dpy, GLXDrawable drawable, struct apple_glx_drawable *d) err = pthread_mutexattr_init(&attr); if (err) { - fprintf(stderr, "pthread_mutexattr_init error: %d\n", err); + fprintf(stderr, "pthread_mutexattr_init error: %s\n", strerror(err)); abort(); } @@ -257,14 +258,14 @@ common_init(Display * dpy, GLXDrawable drawable, struct apple_glx_drawable *d) err = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); if (err) { - fprintf(stderr, "error: setting pthread mutex type: %d\n", err); + fprintf(stderr, "error: setting pthread mutex type: %s\n", strerror(err)); abort(); } err = pthread_mutex_init(&d->mutex, &attr); if (err) { - fprintf(stderr, "pthread_mutex_init error: %d\n", err); + fprintf(stderr, "pthread_mutex_init error: %s\n", strerror(err)); abort(); } -- 2.30.2