From 82fada3af69901136a0d0e1edc9641fa09e9594a Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Sun, 23 May 2021 20:59:00 -0400 Subject: [PATCH] Corrected two somewhat related errors. When "getcell" finds a name conflict and renames a cell, the name was not pointing to the new name and immediately caused a crash condition. However, it got to that point by believing that cell "path/x" and "path/x.mag" were different files. The name was stripped of the extension but the full file path was not, causing the confusion. --- commands/CmdCD.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/commands/CmdCD.c b/commands/CmdCD.c index 57c2dd26..d394264b 100644 --- a/commands/CmdCD.c +++ b/commands/CmdCD.c @@ -4273,6 +4273,11 @@ cmdDumpParseArgs(cmdName, w, cmd, dummy, scx) if ((clen > 4) && !strcmp(cellnameptr + clen - 4, ".mag")) *(cellnameptr + clen - 4) = '\0'; + /* Same for fullpathname */ + clen = strlen(fullpathname); + if ((clen > 4) && !strcmp(fullpathname + clen - 4, ".mag")) + *(fullpathname + clen - 4) = '\0'; + /* Check for illegal characters in the cellname */ if (CmdIllegalChars(cellnameptr, "", "Cell name")) { @@ -4307,8 +4312,8 @@ cmdDumpParseArgs(cmdName, w, cmd, dummy, scx) def = DBCellLookDef(newcellname); uniqchar++; } - TxError("Renaming cell to \"%s\" to avoid conflict.", newcellname); - def = DBCellNewDef(cellnameptr); + TxError("Renaming cell to \"%s\" to avoid conflict.\n", newcellname); + def = DBCellNewDef(newcellname); StrDup(&def->cd_file, fullpathname); freeMagic(newcellname); }