[Cbe-oss-dev] [PATCH]libspe2: make spe_context_create_affinity spec conform

Dirk Herrendoerfer d_herrendoerfer at herrendoerfer.name
Fri Aug 29 19:53:20 EST 2008


According to spec the spe_context_create_affinity() call should
not accept NULL as an argument to gang. 
This fixes it. In case of such an error ESRCH is returned in
errno. 

Signed-off-by: D. Herrendoerfer <d_herrendoerfer at herrendoerfer dot
name >

Index: libspe2/libspe2.c
===================================================================
--- libspe2/libspe2.c	(revision 129)
+++ libspe2/libspe2.c	(working copy)
@@ -60,6 +60,10 @@ spe_context_ptr_t spe_context_create(uns
  */
 spe_context_ptr_t spe_context_create_affinity(unsigned int flags, spe_context_ptr_t affinity_neighbor, spe_gang_context_ptr_t gang)
 {
+	if ( gang == NULL ) {
+		errno = ESRCH;
+		return NULL;
+	}
 	spe_context_ptr_t spe = _base_spe_context_create(flags, gang, affinity_neighbor);
 	if ( spe == NULL ) {
 		return NULL;





More information about the cbe-oss-dev mailing list