From owner-freebsd-bugs@FreeBSD.ORG Wed Feb 6 07:00:10 2008 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00C4016A46B for ; Wed, 6 Feb 2008 07:00:10 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 0770313C4E3 for ; Wed, 6 Feb 2008 07:00:10 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m16709AQ029576 for ; Wed, 6 Feb 2008 07:00:09 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m167091M029571; Wed, 6 Feb 2008 07:00:09 GMT (envelope-from gnats) Date: Wed, 6 Feb 2008 07:00:09 GMT Message-Id: <200802060700.m167091M029571@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Jaakko Heinonen Cc: Subject: Re: bin/21089: vi silently corrupt open file on SIGINT when entering :wq in command mode X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jaakko Heinonen List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2008 07:00:10 -0000 The following reply was made to PR bin/21089; it has been noted by GNATS. From: Jaakko Heinonen To: bug-followup@FreeBSD.org, lfrigault@teaser.fr Cc: lists@MHoerich.de Subject: Re: bin/21089: vi silently corrupt open file on SIGINT when entering :wq in command mode Date: Wed, 6 Feb 2008 08:55:06 +0200 --qDbXVdCdHGoSgWSk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline The bug still exists in 7.0-RC1. I believe that the attached patch fixes it. Can you confirm? -- Jaakko --qDbXVdCdHGoSgWSk Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="nvi-SIGINT.diff" Index: ex/ex_quit.c =================================================================== RCS file: /home/ncvs/src/contrib/nvi/ex/ex_quit.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 ex_quit.c --- ex/ex_quit.c 1 Nov 1996 06:45:30 -0000 1.1.1.1 +++ ex/ex_quit.c 6 Feb 2008 06:45:32 -0000 @@ -35,6 +35,9 @@ { int force; + if (INTERRUPTED(sp)) + return (1); + force = FL_ISSET(cmdp->iflags, E_C_FORCE); /* Check for file modifications, or more files to edit. */ Index: ex/ex_write.c =================================================================== RCS file: /home/ncvs/src/contrib/nvi/ex/ex_write.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 ex_write.c --- ex/ex_write.c 1 Nov 1996 06:45:31 -0000 1.1.1.1 +++ ex/ex_write.c 6 Feb 2008 06:45:32 -0000 @@ -140,6 +140,9 @@ int flags; char *name, *p; + if (INTERRUPTED(sp)) + return (1); + NEEDFILE(sp, cmdp); /* All write commands can have an associated '!'. */ @@ -323,8 +326,6 @@ for (; fline <= tline; ++fline, ++lcnt) { /* Caller has to provide any interrupt message. */ if ((lcnt + 1) % INTERRUPT_CHECK == 0) { - if (INTERRUPTED(sp)) - break; if (!silent) { gp->scr_busy(sp, msg, msg == NULL ? BUSY_UPDATE : BUSY_ON); --qDbXVdCdHGoSgWSk--