ksh/ksh-20090630-jlist.patch
2009-08-27 09:27:35 +00:00

24 lines
827 B
Diff

diff -up ksh-20090630/src/cmd/ksh93/sh/jobs.c.jlist ksh-20090630/src/cmd/ksh93/sh/jobs.c
--- ksh-20090630/src/cmd/ksh93/sh/jobs.c.jlist 2009-04-30 00:07:32.000000000 +0200
+++ ksh-20090630/src/cmd/ksh93/sh/jobs.c 2009-08-27 08:51:48.028116714 +0200
@@ -1745,6 +1745,19 @@ static int job_chksave(register pid_t pi
jpold = jp;
jp = jp->next;
}
+ if(jp && (jp==jpold || count<0))
+ {
+ Sfio_t *log = sfopen((Sfio_t*)0,"/tmp/kshlog","a");
+ if(log)
+ {
+ fchmod(sffileno(log),S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR|S_IWGRP|S_IWOTH);
+ sfprintf(log,"chksave loop jp==jpold=%d jpold=%p jp->pid=%d pid=%d count=%d\n",jp==jpold,jpold,jp->pid,pid,bck.count);
+ sfclose(log);
+ sfsync(log);
+ errormsg(SH_DICT,ERROR_warn(0),"job list infinite loop -- this should not happen");
+ abort();
+ }
+ }
if(jp)
{
r = 0;