mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
Avoid crash due to broken optimisation in job locking [OpenSUSE]
This applies ksh93-jobs.dif from OpenSUSE. Source:
https://build.opensuse.org/package/show/openSUSE:Leap:42.3:Update/ksh
src/cmd/ksh93/sh/jobs.c:
- jog_init(): Save errno in case close(JOBTTY) fails. If cause of
failure was interruption by a signal (EINTR), repeat close.
- job_kill(): Replace Red Hat fix for #35 with nicer OpenSUSE fix
that doesn't add a goto before declaring variables. Re: ff358f34
This commit is contained in:
parent
db72f41f4b
commit
88e8fa67c6
1 changed files with 7 additions and 4 deletions
|
@ -530,12 +530,14 @@ void job_init(Shell_t *shp, int lflag)
|
||||||
/* This should have already been done by rlogin */
|
/* This should have already been done by rlogin */
|
||||||
register int fd;
|
register int fd;
|
||||||
register char *ttynam;
|
register char *ttynam;
|
||||||
|
int err = errno;
|
||||||
#ifndef SIGTSTP
|
#ifndef SIGTSTP
|
||||||
setpgid(0,shp->gd->pid);
|
setpgid(0,shp->gd->pid);
|
||||||
#endif /*SIGTSTP */
|
#endif /*SIGTSTP */
|
||||||
if(job.mypgid<0 || !(ttynam=ttyname(JOBTTY)))
|
if(job.mypgid<0 || !(ttynam=ttyname(JOBTTY)))
|
||||||
return;
|
return;
|
||||||
close(JOBTTY);
|
while(close(JOBTTY)<0 && errno==EINTR)
|
||||||
|
errno = err;
|
||||||
if((fd = open(ttynam,O_RDWR)) <0)
|
if((fd = open(ttynam,O_RDWR)) <0)
|
||||||
return;
|
return;
|
||||||
if(fd!=JOBTTY)
|
if(fd!=JOBTTY)
|
||||||
|
@ -977,9 +979,7 @@ static struct process *job_bystring(register char *ajob)
|
||||||
|
|
||||||
int job_kill(register struct process *pw,register int sig)
|
int job_kill(register struct process *pw,register int sig)
|
||||||
{
|
{
|
||||||
if(!pw)
|
Shell_t *shp;
|
||||||
goto error;
|
|
||||||
Shell_t *shp = pw->p_shp;
|
|
||||||
register pid_t pid;
|
register pid_t pid;
|
||||||
register int r;
|
register int r;
|
||||||
const char *msg;
|
const char *msg;
|
||||||
|
@ -990,6 +990,9 @@ int job_kill(register struct process *pw,register int sig)
|
||||||
#endif /* SIGTSTP */
|
#endif /* SIGTSTP */
|
||||||
job_lock();
|
job_lock();
|
||||||
errno = ECHILD;
|
errno = ECHILD;
|
||||||
|
if(pw==0)
|
||||||
|
goto error;
|
||||||
|
shp = pw->p_shp;
|
||||||
pid = pw->p_pid;
|
pid = pw->p_pid;
|
||||||
if(by_number)
|
if(by_number)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue