Ejemplo n.º 1
0
/* Signal handler for pffexport
 */
void pffexport_signal_handler(
      libcsystem_signal_t signal LIBCSYSTEM_ATTRIBUTE_UNUSED )
{
	libcerror_error_t *error = NULL;
	static char *function   = "pffexport_signal_handler";

	LIBCSYSTEM_UNREFERENCED_PARAMETER( signal )

	pffexport_abort = 1;

	if( pffexport_export_handle != NULL )
	{
		if( export_handle_signal_abort(
		     pffexport_export_handle,
		     &error ) != 1 )
		{
			libcnotify_printf(
			 "%s: unable to signal export handle to abort.\n",
			 function );

			libcnotify_print_error_backtrace(
			 error );
			libcerror_error_free(
			 &error );
		}
	}
	if( pffexport_file != NULL )
	{
		if( libpff_file_signal_abort(
		     pffexport_file,
		     &error ) != 1 )
		{
			libcnotify_printf(
			 "%s: unable to signal file to abort.\n",
			 function );

			libcnotify_print_error_backtrace(
			 error );
			libcerror_error_free(
			 &error );
		}
	}
	/* Force stdin to close otherwise any function reading it will remain blocked
	 */
	if( libcsystem_file_io_close(
	     0 ) != 0 )
	{
		libcnotify_printf(
		 "%s: unable to close stdin.\n",
		 function );
	}
}
Ejemplo n.º 2
0
/* Signal handler for regfexport
 */
void regfexport_signal_handler(
      regftools_signal_t signal REGFTOOLS_ATTRIBUTE_UNUSED )
{
	libcerror_error_t *error = NULL;
	static char *function   = "regfexport_signal_handler";

	REGFTOOLS_UNREFERENCED_PARAMETER( signal )

	regfexport_abort = 1;

	if( regfexport_export_handle != NULL )
	{
		if( export_handle_signal_abort(
		     regfexport_export_handle,
		     &error ) != 1 )
		{
			libcnotify_printf(
			 "%s: unable to signal export handle to abort.\n",
			 function );

			libcnotify_print_error_backtrace(
			 error );
			libcerror_error_free(
			 &error );
		}
	}
	/* Force stdin to close otherwise any function reading it will remain blocked
	 */
#if defined( WINAPI ) && !defined( __CYGWIN__ )
	if( _close(
	     0 ) != 0 )
#else
	if( close(
	     0 ) != 0 )
#endif
	{
		libcnotify_printf(
		 "%s: unable to close stdin.\n",
		 function );
	}
}