From owner-svn-src-head@FreeBSD.ORG Tue Dec 23 17:57:18 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5198A1065676; Tue, 23 Dec 2008 17:57:18 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3FA9F8FC14; Tue, 23 Dec 2008 17:57:18 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBNHvIbo009239; Tue, 23 Dec 2008 17:57:18 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBNHvI9c009238; Tue, 23 Dec 2008 17:57:18 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <200812231757.mBNHvI9c009238@svn.freebsd.org> From: "David E. O'Brien" Date: Tue, 23 Dec 2008 17:57:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186444 - head/usr.sbin/burncd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Dec 2008 17:57:18 -0000 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 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