aur/0002-fix-save-file-tcl.patch

66 lines
2 KiB
Diff

From 6195c20d3d70fbfd47d75103520ada6caf7227cd Mon Sep 17 00:00:00 2001
From: "R. Timothy Edwards" <tim@opencircuitdesign.com>
Date: Mon, 8 Sep 2025 09:22:14 -0400
Subject: [PATCH] Fixed an egregious error introduced by the "save <file>.tcl"
command handling in the previous commit, that can cause a crash whenever
"writeall" is called while a cell's filename is still NULL. Thanks to Daniel
Estevez for reporting the error.
---
VERSION | 2 +-
database/DBio.c | 30 ++++++++++++++++--------------
2 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/VERSION b/VERSION
index 7c64f326..40e58fa1 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-8.3.548
+8.3.549
diff --git a/database/DBio.c b/database/DBio.c
index b17cf4c7..1c07d097 100644
--- a/database/DBio.c
+++ b/database/DBio.c
@@ -4269,25 +4269,27 @@ DBCellWrite(cellDef, fileName)
result = FALSE;
- /* Feature added 9/4/2025: If the filename ends with ".tcl",
- * then write the cell as a series of magic commands, and don't
- * otherwise alter the cell.
- */
- if ((strlen(fileName) > 4) && (!strcmp(fileName + strlen(fileName) - 4, ".tcl")))
+ if (fileName)
{
- if ((realf = fopen(fileName, "w")))
+ /* Feature added 9/4/2025: If the filename ends with ".tcl",
+ * then write the cell as a series of magic commands, and don't
+ * otherwise alter the cell.
+ */
+ if ((strlen(fileName) > 4) && (!strcmp(fileName + strlen(fileName) - 4, ".tcl")))
{
- result = DBCellWriteCommandFile(cellDef, realf);
- fclose(realf);
- return result;
+ if ((realf = fopen(fileName, "w")))
+ {
+ result = DBCellWriteCommandFile(cellDef, realf);
+ fclose(realf);
+ return result;
+ }
}
}
-
- /*
- * Figure out the name of the file we will eventually write.
- */
- if (!fileName)
+ else
{
+ /*
+ * Figure out the name of the file we will eventually write.
+ */
if (cellDef->cd_file)
fileName = cellDef->cd_file;
else if (cellDef->cd_name)