diff mbox

[Ada] Correct error handling in Initialize

Message ID 20111013101742.GA17277@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Oct. 13, 2011, 10:17 a.m. UTC
This change fixes the error handling circuitry in the initialization routine
for suspension objects so that Storage_Error is propagated as intended if
the allocation of the underlying OS entities fails.

No test (requires system resource allocation failure).

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-10-13  Thomas Quinot  <quinot@adacore.com>

	* s-taprop-posix.adb (Initialize): Always raise Storage_Error
	if we fail to initialize CV attributes or CV.
diff mbox

Patch

Index: s-taprop-posix.adb
===================================================================
--- s-taprop-posix.adb	(revision 179894)
+++ s-taprop-posix.adb	(working copy)
@@ -1089,9 +1089,7 @@ 
          Result := pthread_mutex_destroy (S.L'Access);
          pragma Assert (Result = 0);
 
-         if Result = ENOMEM then
-            raise Storage_Error;
-         end if;
+         raise Storage_Error;
       end if;
 
       Result := pthread_cond_init (S.CV'Access, Cond_Attr'Access);
@@ -1101,11 +1099,10 @@ 
          Result := pthread_mutex_destroy (S.L'Access);
          pragma Assert (Result = 0);
 
-         if Result = ENOMEM then
-            Result := pthread_condattr_destroy (Cond_Attr'Access);
-            pragma Assert (Result = 0);
-            raise Storage_Error;
-         end if;
+         Result := pthread_condattr_destroy (Cond_Attr'Access);
+         pragma Assert (Result = 0);
+
+         raise Storage_Error;
       end if;
 
       Result := pthread_condattr_destroy (Cond_Attr'Access);