Mercurial > noffle
diff src/client.c @ 164:94f2e5607772 noffle
[svn] * src/client.c,src/protocol.c,src/util.h,src/util.c: Common up
repeated signal handler setting code into Utl_installSignalHandler.
* src/client.c: Ensure Client_retrieveArt always exits with the global
lock held. Previously it would be held on error, not held if OK.
author | bears |
---|---|
date | Thu, 25 Jan 2001 11:00:03 +0000 |
parents | 976ff791c7ec |
children | 0ce333d046b9 |
line wrap: on
line diff
--- a/src/client.c Sun Jan 07 11:15:58 2001 +0000 +++ b/src/client.c Thu Jan 25 11:00:03 2001 +0000 @@ -1,7 +1,7 @@ /* client.c - $Id: client.c 240 2000-12-10 11:34:50Z enz $ + $Id: client.c 248 2001-01-25 11:00:03Z bears $ */ #if HAVE_CONFIG_H @@ -236,21 +236,6 @@ return; } -static sig_t -installSignalHandler( int sig, sig_t handler ) -{ - struct sigaction act, oldAct; - - act.sa_handler = handler; - sigemptyset( &act.sa_mask ); - act.sa_flags = 0; - if ( sig != SIGALRM ) - act.sa_flags |= SA_RESTART; - if ( sigaction( sig, &act, &oldAct ) < 0 ) - return SIG_ERR; - return oldAct.sa_handler; -} - static Bool connectWithTimeout( int sock, const struct sockaddr *servAddr, socklen_t addrLen ) @@ -258,7 +243,7 @@ sig_t oldHandler; int r, to; - oldHandler = installSignalHandler( SIGALRM, connectAlarm ); + oldHandler = Utl_installSignalHandler( SIGALRM, connectAlarm ); if ( oldHandler == SIG_ERR ) { Log_err( "client.c:connectWithTimeout: signal failed." ); @@ -269,7 +254,7 @@ Log_err( "client.c:connectWithTimeout: Alarm was already set." ); r = connect( sock, servAddr, addrLen ); alarm( 0 ); - installSignalHandler( SIGALRM, oldHandler ); + Utl_installSignalHandler( SIGALRM, oldHandler ); return ( r >= 0 ); } @@ -1100,6 +1085,7 @@ retrievingFailed( msgId, client.lastStat ); else retrieveAndStoreArt( msgId, 0, 0 ); + Lock_openDatabases(); } void