Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/vi/common Prevent nvi from looping infinitely when i...



details:   https://anonhg.NetBSD.org/src/rev/a89ea8e453f2
branches:  trunk
changeset: 513923:a89ea8e453f2
user:      aymeric <aymeric%NetBSD.org@localhost>
date:      Fri Aug 17 21:33:46 2001 +0000

description:
Prevent nvi from looping infinitely when it can't create a temporary file
because of a weird umask for example.
Make it exit instead.
This differs from the OpenBSD behaviour and is believed to be more correct.

Reported by Thomas Klausner in private e-mail, followed by a small discussion in
tech-userlevel a while ago.

diffstat:

 usr.bin/vi/common/exf.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r e4caa09646c4 -r a89ea8e453f2 usr.bin/vi/common/exf.c
--- a/usr.bin/vi/common/exf.c   Fri Aug 17 20:27:12 2001 +0000
+++ b/usr.bin/vi/common/exf.c   Fri Aug 17 21:33:46 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exf.c,v 1.3 2001/03/31 11:37:45 aymeric Exp $  */
+/*     $NetBSD: exf.c,v 1.4 2001/08/17 21:33:46 aymeric Exp $  */
 
 /*-
  * Copyright (c) 1992, 1993, 1994
@@ -184,6 +184,11 @@
         */
        oname = frp->name;
        if (LF_ISSET(FS_OPENERR) || oname == NULL || !exists) {
+               /*
+                * Don't try to create a temporary support file twice.
+                */
+               if (frp->tname != NULL)
+                       goto err;
                if (opts_empty(sp, O_DIRECTORY, 0))
                        goto err;
                (void)snprintf(tname, sizeof(tname),
@@ -266,7 +271,7 @@
                 * be read.  This isn't useful for single files from a command
                 * line, but it's quite useful for "vi *.c", since you can skip
                 * past files that you can't read.
-                */ 
+                */
                open_err = 1;
                goto oerr;
        }



Home | Main Index | Thread Index | Old Index