zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: [PATCH] Another from Etc/BUGS: remove =(...) files on exit
Date: Fri, 29 Apr 2022 22:15:00 -0700	[thread overview]
Message-ID: <CAH+w=7ZMZVBqFAuZD0Tjivuhb9Y9PwQL7EjVKLYnx8amhtsu6A@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 136 bytes --]

This appears to be pretty straightforward.

I'm wondering if clearjobtab() should do something with the memory
pointed to by filelists?

[-- Attachment #2: cleanfiles.txt --]
[-- Type: text/plain, Size: 833 bytes --]

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)

                 reply	other threads:[~2022-04-30  5:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7ZMZVBqFAuZD0Tjivuhb9Y9PwQL7EjVKLYnx8amhtsu6A@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).