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

PATCH: Re: BUG: jobs -d causes core dump



Felix Rosencrantz wrote:

> When I attempt to run "jobs -l -d" I get a core dump, with the following
> stack trace.
> 
> I think the problem occurs when there is a job in the background that was
> started in the current directory.  It seems like the pathname in the Job
> structure is a NULL pointer at that time.  

Right. Saves us lots of unnecessary dups or copies.

Bye
 Sven

Index: Src/jobs.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/jobs.c,v
retrieving revision 1.2
diff -u -r1.2 jobs.c
--- Src/jobs.c	2000/04/01 20:49:48	1.2
+++ Src/jobs.c	2000/05/05 07:17:13
@@ -734,7 +734,7 @@
     if ((lng & 4) || (interact && job == thisjob &&
 		      jn->pwd && strcmp(jn->pwd, pwd))) {
 	fprintf(shout, "(pwd %s: ", (lng & 4) ? "" : "now");
-	fprintdir((lng & 4) ? jn->pwd : pwd, shout);
+	fprintdir(((lng & 4) && jn->pwd) ? jn->pwd : pwd, shout);
 	fprintf(shout, ")\n");
 	fflush(shout);
     }

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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