Changeset 9196
- Timestamp:
- Sep 27, 2009, 8:32:32 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gtk/main.c
r9130 r9196 260 260 261 261 static sig_atomic_t global_sigcount = 0; 262 263 static void 264 fatalsig( int sig ) 265 { 266 /* revert to default handler after this many */ 267 static const int SIGCOUNT_MAX = 3; 268 269 if( ++global_sigcount >= SIGCOUNT_MAX ) 262 static struct cbdata * sighandler_cbdata = NULL; 263 264 static void 265 signal_handler( int sig ) 266 { 267 if( ++global_sigcount > 1 ) 270 268 { 271 269 signal( sig, SIG_DFL ); 272 270 raise( sig ); 273 271 } 272 else switch( sig ) 273 { 274 case SIGINT: 275 g_message( _( "Got signal %d; trying to shut down cleanly. Do it again if it gets stuck." ), sig ); 276 doAction( "quit", sighandler_cbdata ); 277 break; 278 } 274 279 } 275 280 … … 277 282 setupsighandlers( void ) 278 283 { 279 #ifdef G_OS_WIN32 280 const int sigs[] = { SIGINT, SIGTERM }; 281 #else 282 const int sigs[] = { SIGHUP, SIGINT, SIGQUIT, SIGTERM }; 283 #endif 284 guint i; 285 286 for( i = 0; i < G_N_ELEMENTS( sigs ); ++i ) 287 signal( sigs[i], fatalsig ); 284 signal( SIGINT, signal_handler ); 288 285 } 289 286 … … 435 432 struct cbdata * cbdata = g_new0( struct cbdata, 1 ); 436 433 434 sighandler_cbdata = cbdata; 435 437 436 /* ensure the directories are created */ 438 if(( str = pref_string_get( PREF_KEY_DIR_WATCH )))439 gtr_mkdir_with_parents( str, 0777 );440 if(( str = pref_string_get( TR_PREFS_KEY_DOWNLOAD_DIR )))441 gtr_mkdir_with_parents( str, 0777 );437 if(( str = pref_string_get( PREF_KEY_DIR_WATCH ))) 438 gtr_mkdir_with_parents( str, 0777 ); 439 if(( str = pref_string_get( TR_PREFS_KEY_DOWNLOAD_DIR ))) 440 gtr_mkdir_with_parents( str, 0777 ); 442 441 443 442 /* initialize the libtransmission session */
Note: See TracChangeset
for help on using the changeset viewer.