do not crash when killing last bg job when there is not any

This commit is contained in:
Michal Hlavinka 2011-08-12 15:59:01 +02:00
parent cce7c12c1f
commit f57567a859
2 changed files with 28 additions and 1 deletions

View File

@ -0,0 +1,20 @@
diff -up ksh-20110630/src/cmd/ksh93/sh/jobs.c.orig ksh-20110630/src/cmd/ksh93/sh/jobs.c
--- ksh-20110630/src/cmd/ksh93/sh/jobs.c.orig 2011-08-12 11:50:39.059283656 +0200
+++ ksh-20110630/src/cmd/ksh93/sh/jobs.c 2011-08-12 11:52:02.237911639 +0200
@@ -1103,7 +1103,7 @@ static struct process *job_bystring(regi
int job_kill(register struct process *pw,register int sig)
{
- Shell_t *shp = pw->p_shp;
+ Shell_t *shp;
register pid_t pid;
register int r;
const char *msg;
@@ -1116,6 +1116,7 @@ int job_kill(register struct process *pw
errno = ECHILD;
if(pw==0)
goto error;
+ shp = pw->p_shp;
pid = pw->p_pid;
#if SHOPT_COSHELL
if(pw->p_cojob)

View File

@ -6,7 +6,7 @@ URL: http://www.kornshell.com/
Group: System Environment/Shells
License: CPL
Version: 20110630
Release: 2%{?dist}
Release: 3%{?dist}
Source0: http://www.research.att.com/~gsf/download/tgz/ast-ksh.%{releasedate}.tgz
Source1: http://www.research.att.com/~gsf/download/tgz/INIT.%{releasedate}.tgz
Source3: kshrc.rhs
@ -23,6 +23,9 @@ Patch2: ksh-20100826-fixregr.patch
# for ksh < 2011-08-03
Patch3: ksh-20110630-ifsfix.patch
# sent upstream, for ksh <= 2011-08-12
Patch4: ksh-20110630-fixkill.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Conflicts: pdksh
Requires: coreutils, glibc-common, diffutils
@ -44,6 +47,7 @@ with "sh" (the Bourne Shell).
%patch1 -p1 -b .builtins
%patch2 -p1 -b .fixregr
%patch3 -p1 -b .ifsfix
%patch4 -p1 -b .fixkill
#/dev/fd test does not work because of mock
sed -i 's|ls /dev/fd|ls /proc/self/fd|' src/cmd/ksh93/features/options
@ -124,6 +128,9 @@ fi
rm -rf $RPM_BUILD_ROOT
%changelog
* Fri Aug 12 2011 Michal Hlavinka <mhlavink@redhat.com> - 20110630-3
- do not crash when killing last bg job when there is not any
* Wed Aug 03 2011 Michal Hlavinka <mhlavink@redhat.com> - 20110630-2
- fix: IFS manipulation in a function can cause crash