1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 19:52:20 +00:00

Fix locking error in spawn implementation

This applies a patch from OpenSUSE. Source:
https://build.opensuse.org/package/view_file/shells/ksh/ksh93-spawnlock.dif

| Wed Oct 12 13:23:14 CEST 2016 - mls@suse.de
|
| - fix locking error in spawn implementation [bnc#988213]
|   new patch: ksh93-spawnlock.dif

Unfortunately the bug report is not currently public:
https://bugzilla.opensuse.org/show_bug.cgi?id=988213
but this one seems sensible enough and is in production use,
so I'll take it on faith.
This commit is contained in:
Martijn Dekker 2021-01-27 05:32:24 +00:00
parent a5c53a59e1
commit 6d1352699e
2 changed files with 7 additions and 1 deletions

View file

@ -1947,6 +1947,10 @@ void job_fork(pid_t parent)
job_lock();
jobfork++;
break;
case -2:
jobfork--;
job_unlock();
break;
case 0:
jobfork=0;
job_unlock();

View file

@ -3631,6 +3631,7 @@ static pid_t sh_ntfork(Shell_t *shp,const Shnode_t *t,char *argv[],int *jobid,in
# endif /* !_lib_fork */
sh_pushcontext(shp,buffp,SH_JMPCMD);
errorpush(&buffp->err,ERROR_SILENT);
job_lock(); /* errormsg will unlock */
jmpval = sigsetjmp(buffp->buff,0);
if(jmpval == 0)
{
@ -3732,7 +3733,7 @@ static pid_t sh_ntfork(Shell_t *shp,const Shnode_t *t,char *argv[],int *jobid,in
}
fail:
if(jobfork && spawnpid<0)
job_fork(0);
job_fork(-2);
if(spawnpid < 0) switch(errno=shp->path_err)
{
case ENOENT:
@ -3740,6 +3741,7 @@ static pid_t sh_ntfork(Shell_t *shp,const Shnode_t *t,char *argv[],int *jobid,in
default:
errormsg(SH_DICT,ERROR_system(ERROR_NOEXEC),e_exec+4);
}
job_unlock();
}
else
exitset();