comparison src/util.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 3c71e28c8eef
children fed1334d766b
comparison
equal deleted inserted replaced
163:3d243292468d 164:94f2e5607772
1 /* 1 /*
2 util.c 2 util.c
3 3
4 $Id: util.c 183 2000-07-25 12:14:54Z bears $ 4 $Id: util.c 248 2001-01-25 11:00:03Z bears $
5 */ 5 */
6 6
7 #if HAVE_CONFIG_H 7 #if HAVE_CONFIG_H
8 #include <config.h> 8 #include <config.h>
9 #endif 9 #endif
460 exit( EXIT_FAILURE ); 460 exit( EXIT_FAILURE );
461 } 461 }
462 memcpy( *dst, src, (size_t)len + 1 ); 462 memcpy( *dst, src, (size_t)len + 1 );
463 } 463 }
464 464
465 sig_t
466 Utl_installSignalHandler( int sig, sig_t handler )
467 {
468 struct sigaction act, oldAct;
469
470 act.sa_handler = handler;
471 sigemptyset( &act.sa_mask );
472 act.sa_flags = 0;
473 if ( sig != SIGALRM )
474 act.sa_flags |= SA_RESTART;
475 if ( sigaction( sig, &act, &oldAct ) < 0 )
476 return SIG_ERR;
477 return oldAct.sa_handler;
478 }
479
465 #if defined(UTIL_TEST) 480 #if defined(UTIL_TEST)
466 481
467 /* Test code borrowed from wildmat.c. Yep, still uses gets(). */ 482 /* Test code borrowed from wildmat.c. Yep, still uses gets(). */
468 extern char *gets(); 483 extern char *gets();
469 484