/**
 * @brief Telemetry API deinitialization function.
 *
 * See scssdk_telemetry.h
 */
SCSAPI_VOID scs_telemetry_shutdown(void)
{
	// Any cleanup needed. The registrations will be removed automatically
	// so there is no need to do that manually.

	game_log = NULL;
	finish_log();
}
BOOL APIENTRY DllMain(
	HMODULE module,
	DWORD  reason_for_call,
	LPVOID reseved
)
{
	if (reason_for_call == DLL_PROCESS_DETACH) {
		finish_log();
	}
	return TRUE;
}
Exemple #3
0
/*
 * Last exit routine...
 * Use global *tty_tmp and terms[]
 */
void 
g00dbye(void)
{
    write_log(0," g00dbye function called from %d\n",(int)pthread_self());
    
    term_delete_all_tty();
    
#ifdef HAS_CURSES
    if (tty_tmp->interactive && (terms->gui_th.id != 0))
       thread_destroy(&terms->gui_th);
#endif

#ifdef HAVE_GTK
    if (tty_tmp->gtk && (terms->gui_gtk_th.id != 0)) {
       thread_destroy(&terms->gui_gtk_th);
    }
#endif

#ifdef HAVE_REMOTE_ADMIN
    if (tty_tmp->daemonize)
       admin_exit();
#endif

   /* Kill Uptime thread... */
   if (terms->uptime_th.id)
      thread_destroy_cancel(terms->uptime_th.id);
    
   if (tty_tmp && tty_tmp->term)
      free(tty_tmp->term);

   /* Destroy interfaces only if they are initialized!! */
   if (terms) 
      interfaces_destroy(&terms->pcap_listen_th);

   protocol_destroy();

   if (terms)
      term_destroy();
   
   if (!tty_tmp->daemonize)
   {
      write_log(0, " Showing MOTD..\n");
      show_vty_motd();
   }

   finish_log();

   if (tty_tmp)
      free(tty_tmp);

   exit(0);
}
 ~defaultStream() { 
   if (has_log_file())  finish_log();
 }
Exemple #5
0
/*---------------------------------------------------------------------------*
 *	re-open the log/acct files on SIGUSR1
 *---------------------------------------------------------------------------*/
void
reopenfiles(int dummy)
{
        if(useacctfile)
	{
		/* close file */

		if(acctfp)
		{
		        fflush(acctfp);
		        fclose(acctfp);
		}

	        /* if user specified a suffix, rename the old file */

	        if(rotatesuffix[0] != '\0')
	        {
	        	char filename[MAXPATHLEN];

	        	snprintf(filename, sizeof(filename), "%s%s", acctfile, rotatesuffix);

			if((rename(acctfile, filename)) != 0)
			{
				dolog(LL_ERR, "reopenfiles: acct rename failed, cause = %s", strerror(errno));
				error_exit(1, "reopenfiles: acct rename failed, cause = %s", strerror(errno));
			}
		}

		if((acctfp = fopen(acctfile, "a")) == NULL)
		{
			dolog(LL_ERR, "ERROR, can't open acctfile %s for writing, terminating!", acctfile);
			error_exit(1, "ERROR, can't open acctfile %s for writing, terminating!", acctfile);
		}
		setvbuf(acctfp, NULL, _IONBF, 0);
	}

	if(uselogfile)
	{
	        finish_log();

	        /* if user specified a suffix, rename the old file */

	        if(rotatesuffix[0] != '\0')
	        {
	        	char filename[MAXPATHLEN];

	        	snprintf(filename, sizeof(filename), "%s%s", logfile, rotatesuffix);

			if((rename(logfile, filename)) != 0)
			{
				dolog(LL_ERR, "reopenfiles: log rename failed, cause = %s", strerror(errno));
				error_exit(1, "reopenfiles: log rename failed, cause = %s", strerror(errno));
			}
		}

	        if((logfp = fopen(logfile, "a")) == NULL)
		{
			fprintf(stderr, "ERROR, cannot open logfile %s: %s\n",
				logfile, strerror(errno));
			error_exit(1, "reopenfiles: ERROR, cannot open logfile %s: %s\n",
				logfile, strerror(errno));
		}

		/* set unbuffered operation */

		setvbuf(logfp, NULL, _IONBF, 0);
	}
}