Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Dec 2008 17:57:18 +0000 (UTC)
From:      "David E. O'Brien" <obrien@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r186444 - head/usr.sbin/burncd
Message-ID:  <200812231757.mBNHvI9c009238@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: obrien
Date: Tue Dec 23 17:57:17 2008
New Revision: 186444
URL: http://svn.freebsd.org/changeset/base/186444

Log:
  Make signal handler safer.
  
  Submitted by:	Jaakko Heinonen <jh@saunalahti.fi>

Modified:
  head/usr.sbin/burncd/burncd.c

Modified: head/usr.sbin/burncd/burncd.c
==============================================================================
--- head/usr.sbin/burncd/burncd.c	Tue Dec 23 17:55:37 2008	(r186443)
+++ head/usr.sbin/burncd/burncd.c	Tue Dec 23 17:57:17 2008	(r186444)
@@ -58,7 +58,8 @@ struct track_info {
 	int	addr;
 };
 static struct track_info tracks[100];
-static int global_fd_for_cleanup, quiet, verbose, saved_block_size, notracks;
+static int quiet, verbose, saved_block_size, notracks;
+static volatile int global_fd_for_cleanup;
 
 void add_track(char *, int, int, int);
 void do_DAO(int fd, int, int);
@@ -716,11 +717,12 @@ cleanup_flush(void)
 }
 
 void
-cleanup_signal(int sig __unused)
+cleanup_signal(int sig)
 {
-	cleanup_flush();
-	fprintf(stderr, "\n");
-	errx(EXIT_FAILURE, "Aborted");
+	signal(sig, SIG_IGN);
+	ioctl(global_fd_for_cleanup, CDRIOCFLUSH);
+	write(STDERR_FILENO, "\nAborted\n", 10);
+	_exit(EXIT_FAILURE);
 }
 
 void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812231757.mBNHvI9c009238>