do not segfault on kill % (#914669)

This commit is contained in:
Michal Hlavinka 2013-02-22 16:45:55 +01:00
parent 147f917cee
commit 0a835abdfb
2 changed files with 27 additions and 1 deletions

View File

@ -0,0 +1,21 @@
diff -up ksh-20130214/src/cmd/ksh93/sh/jobs.c.fixkill ksh-20130214/src/cmd/ksh93/sh/jobs.c
--- ksh-20130214/src/cmd/ksh93/sh/jobs.c.fixkill 2012-09-26 17:43:04.000000000 +0200
+++ ksh-20130214/src/cmd/ksh93/sh/jobs.c 2013-02-22 16:38:05.080161740 +0100
@@ -1104,6 +1104,8 @@ static struct process *job_bystring(regi
int job_kill(register struct process *pw,register int sig)
{
+ if(pw==0)
+ goto error;
Shell_t *shp = pw->p_shp;
register pid_t pid;
register int r;
@@ -1127,8 +1129,6 @@ int job_kill(register struct process *pw
#endif /* SIGTSTP */
job_lock();
errno = ECHILD;
- if(pw==0)
- goto error;
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: EPL
Version: 20120801
Release: 6%{?dist}
Release: 7%{?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
Source2: kshcomp.conf
@ -24,6 +24,7 @@ Patch3: rmdirfix.patch
Patch4: ksh-20120801-cdfix.patch
Patch5: ksh-20120801-tabfix.patch
Patch6: ksh-20120801-cdfix2.patch
Patch7: ksh-20130214-fixkill.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Conflicts: pdksh
@ -49,6 +50,7 @@ with "sh" (the Bourne Shell).
%patch4 -p1 -b .cdfix
%patch5 -p1 -b .tabfix
%patch6 -p1 -b .cdfix2
%patch7 -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
@ -142,6 +144,9 @@ fi
rm -rf $RPM_BUILD_ROOT
%changelog
* Fri Feb 22 2013 Michal Hlavinka <mhlavink@redhat.com> - 20120801-7
- do not segfault on kill % (#914669)
* Fri Feb 01 2013 Michal Hlavinka <mhlavink@redhat.com> - 20120801-6
- cd file did not produce any error