Replace siginterrupt () in gnutls
PATCH 1/1 Replace siginterrupt () in gnutls
Hi
This patch replace use of siginterrupt () by sigaction as reccommended on opengroup docs
http://www.opengroup.org/onlinepubs/000095399/functions/siginterrupt.html
uclibc have conditionalized this function as SUSV4_LEGACY. I could have enabled this option but I chose to fix gnutls
OK for .dev
Thx
-Khem
src/tests.c +10 -2
@@ -491,6 +491,7 @@int old, secs =6 ;#ifndef _WIN32 +struct sigaction act;signal (SIGALRM , got_alarm);#endif
@@ -511,7 +512,9 @@return TEST_FAILED ;#ifndef _WIN32 - old =siginterrupt (SIGALRM ,1 ); + (void )sigaction (SIGALRM ,NULL , &act); + act.sa_flags &= ~SA_RESTART ; + old =sigaction (SIGALRM , &act,NULL );alarm (secs);#else setsockopt ((int)gnutls_transport_get_ptr (session), SOL_SOCKET, SO_RCVTIMEO,
@@ -525,7 +528,12 @@while (ret >0 );#ifndef _WIN32 -siginterrupt (SIGALRM , old); + (void )sigaction (SIGALRM ,NULL , &act); +if (old) + act.sa_flags &= ~SA_RESTART ; +else + act.sa_flags |=SA_RESTART ; +sigaction (SIGALRM , &act,NULL );#else if (WSAGetLastError () ==WSAETIMEDOUT ||WSAGetLastError () ==WSAECONNABORTED )
Quoted 44 lines · Khem Raj
Hi
This patch replace use of siginterrupt () by sigaction as reccommended on opengroup docs
http://www.opengroup.org/onlinepubs/000095399/functions/siginterrupt.html
uclibc have conditionalized this function as
SUSV4_LEGACY. I could have enabled this option but I chose to fix gnutlsOK for .dev
Thx
-Khem
Index:
gnutls-2.4.2/src/tests.c
===================================================================src/tests.c +4
-1@@ -491,6 +491,7 @@int old, secs =6 ;#ifndef _WIN32 +struct sigaction act;signal (SIGALRM , got_alarm);#endif @@ -511,7 +512,9 @@return TEST_FAILED ;#ifndef _WIN32 - old =siginterrupt (SIGALRM ,1 ); + (void )sigaction (SIGALRM ,NULL , &act); + act.sa_flags &= ~SA_RESTART ; + old =sigaction (SIGALRM , &act,NULL );alarm (secs);#else setsockopt ((int)gnutls_transport_get_ptr (session), SOL_SOCKET, SO_RCVTIMEO,@@ -525,7 +528,12 @@while (ret >0 );#ifndef _WIN32
src/tests.c line 539
Quoted 10 lines
src/tests.c +6
-1-siginterrupt (SIGALRM , old); + (void )sigaction (SIGALRM ,NULL , &act); +if (old) + act.sa_flags &= ~SA_RESTART ; +else + act.sa_flags |=SA_RESTART ; +sigaction (SIGALRM , &act,NULL );#else if (WSAGetLastError () ==WSAETIMEDOUT ||WSAGetLastError () ==WSAECONNABORTED )
+1
Bye Henning