shithub: Nail

Download patch

ref: 6fdb0c393d1a161ae45ce6090a185e57f9c516a6
parent: f15f4664195c86c3a732fc69573b3341c18fbb02
author: Ori Bernstein <[email protected]>
date: Thu Nov 5 17:23:32 EST 2020

fix htmlfmt exec

The sync between execfmt and the parent happened before
procexecl managed to complete, which meant that m->path
argument could be free'd in the meantime, resulting in weird
htmlfmt complaints about  no file argument  (surprising that
m->path was apparently   after free)

The fix is to pass m->sync as a pidc argument to procexecl,
after which it is safe to free its arguments.

--- a/mesg.c
+++ b/mesg.c
@@ -191,8 +191,7 @@
 	dup(m->fd[1], 1);
 	close(m->fd[0]);
 	close(m->fd[1]);
-	sendul(m->sync, 0);
-	procexecl(nil, "/bin/htmlfmt", "-a", "-cutf-8", m->path, nil);
+	procexecl(m->sync, "/bin/htmlfmt", "htmlfmt", "-a", "-cutf-8", m->path, nil);
 }
 
 static int
@@ -235,6 +234,8 @@
 
 	if((wfd = winopen(m, "body", OWRITE)) == -1)
 		return -1;
+	if(m->parent != nil)
+		fprint(wfd, "Upthread: %s\n", m->parent->name);
 	fprint(wfd, "From: %s\n", m->fromcolon);
 	fprint(wfd, "To:   %s\n", m->to);
 	fprint(wfd, "Date: %s\n", m->date);
@@ -332,8 +333,10 @@
 	{"Q",		qreply},
 	{"Reply",	reply},
 	{"Delmesg",	delmesg},
-	{"Save",	nil},
 	{"Del", 	mesgquit},
+#ifdef NOTYET
+	{"Save",	nil},
+#endif
 	{nil}
 };