[alsa-devel] [PATCH 2/2 v2] crec: Add primitive exception handling

Mark Brown broonie at kernel.org
Tue Dec 3 19:22:56 CET 2013


On Tue, Dec 03, 2013 at 04:27:55PM +0000, Charles Keepax wrote:

> +static void sig_handler(int signum __attribute__ ((unused)))
> +{
> +	printf("Interrupted, saving what we have!\n");
> +
> +	finish_record();
> +
> +	if (file)
> +		fclose(file);
> +
> +	_exit(EXIT_FAILURE);
> +}

You can't safely do most of this such as calling fclose() from within a
signal handler, the set of functions that are guaranteed safe is quite
limited - see signal(7).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20131203/0ae1dc48/attachment.sig>


More information about the Alsa-devel mailing list