From 87e44b0d8c6a90d958cdbb9ebaaa7a64901f9923 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Thu, 14 Dec 2017 21:48:01 -0500 Subject: [PATCH] Corrected an issue in which netgen would attempt to find a file from a ".include" line by trying alternate extensions. This should be discouraged, as it happened that a file included "name.defparams", a file that didn't exist, and instead of calling out the missing file, it recast it to "name.spice" and caused it to drop into an infinite loop. Oops. --- base/spice.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/base/spice.c b/base/spice.c index 65a405a..6b1ba2d 100644 --- a/base/spice.c +++ b/base/spice.c @@ -1941,12 +1941,15 @@ void IncludeSpice(char *fname, int parent, struct cellstack **CellStackPtr, if ((filenum = OpenParseFile(fname, parent)) < 0) { /* If that fails, see if a standard SPICE extension */ - /* helps. But really, we're getting desperate at this */ - /* point. */ + /* helps, if the file didn't have an extension. But */ + /* really, we're getting desperate at this point. */ - SetExtension(name, fname, SPICE_EXTENSION); - if ((filenum = OpenParseFile(name, parent)) < 0) { - Fprintf(stderr,"Error in SPICE file read: No file %s\n",name); + if (strchr(fname, '.') == NULL) { + SetExtension(name, fname, SPICE_EXTENSION); + filenum = OpenParseFile(name, parent); + } + if (filenum < 0) { + Fprintf(stderr,"Error in SPICE file include: No file %s\n",name); return; } }