Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] Another from Etc/BUGS: remove =(...) files on exit



This appears to be pretty straightforward.

I'm wondering if clearjobtab() should do something with the memory
pointed to by filelists?
diff --git a/Src/builtin.c b/Src/builtin.c
index b93466ba5..1cef7cce8 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -5860,6 +5860,7 @@ zexit(int val, enum zexit_t from_where)
 	/* send SIGHUP to any jobs left running  */
 	killrunjobs(from_where == ZEXIT_SIGNAL);
     }
+    cleanfilelists();
     if (isset(RCS) && interact) {
 	if (!nohistsave) {
 	    int writeflags = HFILE_USE_OPTIONS;
diff --git a/Src/jobs.c b/Src/jobs.c
index 85d4c4d1f..a91ef787f 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -1366,6 +1366,18 @@ deletefilelist(LinkList file_list, int disowning)
     }
 }
 
+/**/
+void
+cleanfilelists(void)
+{
+    int i;
+
+    DPUTS(shell_exiting >= 0, "BUG: cleanfilelists() before exit");
+ 
+    for (i = 1; i <= maxjob; i++)
+	deletefilelist(jobtab[i].filelist, 0);
+}
+
 /**/
 void
 freejob(Job jn, int deleting)


Messages sorted by: Reverse Date, Date, Thread, Author