Use posix exit code if last command exits due to a signal
Resolves: #1471874
This commit is contained in:
parent
c4d3e851d9
commit
470f54ec47
24
ksh-20120801-posix-exit.patch
Normal file
24
ksh-20120801-posix-exit.patch
Normal file
@ -0,0 +1,24 @@
|
||||
diff --git a/src/cmd/ksh93/sh/fault.c b/src/cmd/ksh93/sh/fault.c
|
||||
--- a/src/cmd/ksh93/sh/fault.c
|
||||
+++ b/src/cmd/ksh93/sh/fault.c
|
||||
@@ -643,7 +643,7 @@ void sh_done(void *ptr, register int sig)
|
||||
sfsync((Sfio_t*)sfstdin);
|
||||
sfsync((Sfio_t*)shp->outpool);
|
||||
sfsync((Sfio_t*)sfstdout);
|
||||
- if(savxit&SH_EXITSIG)
|
||||
+ if((savxit&SH_EXITMASK) == shp->lastsig)
|
||||
sig = savxit&SH_EXITMASK;
|
||||
if(sig)
|
||||
{
|
||||
@@ -668,6 +668,12 @@ void sh_done(void *ptr, register int sig)
|
||||
if(sh_isoption(SH_NOEXEC))
|
||||
kiaclose((Lex_t*)shp->lex_context);
|
||||
#endif /* SHOPT_KIA */
|
||||
+
|
||||
+ /* Return POSIX exit code if last process exits due to signal */
|
||||
+ if (savxit & SH_EXITSIG) {
|
||||
+ exit(128 + (savxit&SH_EXITMASK));
|
||||
+ }
|
||||
+
|
||||
exit(savxit&SH_EXITMASK);
|
||||
}
|
9
ksh.spec
9
ksh.spec
@ -8,7 +8,7 @@ URL: http://www.kornshell.com/
|
||||
#CPL everywhere else (for KSH itself)
|
||||
License: CPL
|
||||
Version: %{releasedate}
|
||||
Release: 40%{?dist}
|
||||
Release: 41%{?dist}
|
||||
Source0: http://www.research.att.com/~gsf/download/tgz/ast-ksh.%{release_date}.tgz
|
||||
Source1: http://www.research.att.com/~gsf/download/tgz/INIT.%{release_date}.tgz
|
||||
Source2: kshcomp.conf
|
||||
@ -196,6 +196,9 @@ Patch80: ksh-20120801-jobwait-sigstop.patch
|
||||
# rhbz#1462347
|
||||
Patch81: ksh-20120801-subshell-jobwait.patch
|
||||
|
||||
# rhbz#1471874
|
||||
Patch82: ksh-20120801-posix-exit.patch
|
||||
|
||||
Conflicts: pdksh
|
||||
Requires: coreutils, diffutils, chkconfig
|
||||
BuildRequires: bison
|
||||
@ -319,6 +322,10 @@ fi
|
||||
%config(noreplace) %{_sysconfdir}/binfmt.d/kshcomp.conf
|
||||
|
||||
%changelog
|
||||
* Mon Aug 14 2017 Siteshwar Vashisht <svashisht@redhat.com> - 20120801-41
|
||||
- Use posix exit code if last command exits due to a signal
|
||||
Resolves: #1471874
|
||||
|
||||
* Mon Aug 14 2017 Siteshwar Vashisht <svashisht@redhat.com> - 20120801-40
|
||||
- Fix condition to fork subshell
|
||||
Resolves: #1462347
|
||||
|
Loading…
Reference in New Issue
Block a user