summaryrefslogtreecommitdiff
path: root/devel/sdl/files/patch-af
blob: 28c3cfef4b85b4c96a0225e280e0f0493323fc01 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
--- src/thread/linux/SDL_mutex.c.orig	Tue Nov 23 20:01:41 1999
+++ src/thread/linux/SDL_mutex.c	Mon Apr 17 21:08:57 2000
@@ -42,6 +42,7 @@
 
 #ifdef SDL_USE_PTHREADS
 
+#include <errno.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <pthread.h>
@@ -60,14 +61,14 @@
 	SDL_mutex *mutex;
 
 	/* Allocate the structure */
-	mutex = (SDL_mutex *)malloc(sizeof(*mutex));
+	mutex = (SDL_mutex *)malloc(sizeof(mutex));
 	if ( mutex == NULL ) {
 		SDL_OutOfMemory();
 		return(NULL);
 	}
 
 	if ( pthread_mutex_init(&mutex->id, NULL) != 0 ) {
-		SDL_SetError("Couldn't create mutex");
+		SDL_SetError("Couldn't create mutex; reason: %d", errno);
 		free(mutex);
 		return(NULL);
 	}
@@ -82,7 +83,7 @@
 		return(-1);
 	}
 	if ( pthread_mutex_lock(&mutex->id) != 0 ) {
-		SDL_SetError("Couldn't lock mutex");
+		SDL_SetError("Couldn't lock mutex; reason: %d", errno);
 		return(-1);
 	}
 	return(0);
@@ -96,7 +97,7 @@
 		return(-1);
 	}
 	if ( pthread_mutex_unlock(&mutex->id) != 0 ) {
-		SDL_SetError("Couldn't unlock mutex");
+		SDL_SetError("Couldn't unlock mutex; reason: %d", errno);
 		return(-1);
 	}
 	return(0);