Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/vi/ex . Don't call terminate() after read_prompt() f...
details: https://anonhg.NetBSD.org/src/rev/c0f3a0209486
branches: trunk
changeset: 541985:c0f3a0209486
user: aymeric <aymeric%NetBSD.org@localhost>
date: Mon Jan 20 16:10:51 2003 +0000
description:
. Don't call terminate() after read_prompt() failed.
Fixes memory re-use after free().
. Fake a directory name of "." if given a path without '/'.
This makes ":cs add cscope.out" work, and behave like ":cs add ."
diffstat:
usr.bin/vi/ex/ex_cscope.c | 16 +++++++---------
1 files changed, 7 insertions(+), 9 deletions(-)
diffs (44 lines):
diff -r f0e0b7c1169e -r c0f3a0209486 usr.bin/vi/ex/ex_cscope.c
--- a/usr.bin/vi/ex/ex_cscope.c Mon Jan 20 15:45:40 2003 +0000
+++ b/usr.bin/vi/ex/ex_cscope.c Mon Jan 20 16:10:51 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ex_cscope.c,v 1.6 2002/04/09 01:47:33 thorpej Exp $ */
+/* $NetBSD: ex_cscope.c,v 1.7 2003/01/20 16:10:51 aymeric Exp $ */
/*-
* Copyright (c) 1994, 1996
@@ -252,6 +252,10 @@
dbname = CSCOPE_DBFILE;
} else if ((dbname = strrchr(dname, '/')) != NULL)
*dbname++ = '\0';
+ else {
+ dbname = dname;
+ dname = ".";
+ }
/* Allocate a cscope connection structure and initialize its fields. */
len = strlen(dname);
@@ -277,12 +281,7 @@
LIST_INSERT_HEAD(&exp->cscq, csc, q);
/* Read the initial prompt from the cscope to make sure it's okay. */
- if (read_prompt(sp, csc)) {
- terminate(sp, csc, 0);
- return (1);
- }
-
- return (0);
+ return read_prompt(sp, csc);
err: free(csc);
return (1);
@@ -764,8 +763,7 @@
++*matchesp;
}
- (void)read_prompt(sp, csc);
- return (0);
+ return read_prompt(sp, csc);
io_err: if (feof(csc->from_fp))
errno = EIO;
Home |
Main Index |
Thread Index |
Old Index