Date: Wed, 6 Feb 2008 07:00:09 GMT From: Jaakko Heinonen <jh@saunalahti.fi> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/21089: vi silently corrupt open file on SIGINT when entering :wq in command mode Message-ID: <200802060700.m167091M029571@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/21089; it has been noted by GNATS. From: Jaakko Heinonen <jh@saunalahti.fi> 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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802060700.m167091M029571>