1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Remove obsolete and partial crash workaround (re: 61437b27, 51b2e360)

The fix for #103 was incomplete and papered over the problem. The
real fix for this bug was applied in 51b2e36 on 20th February 2021.
That crash was the same one triggered differently.

https://github.com/ksh93/ksh/issues/103#issuecomment-1188666733
This commit is contained in:
Martijn Dekker 2022-07-19 08:54:19 +02:00
parent 6c71c5ec4f
commit 60b3e3a28d

View file

@ -2125,17 +2125,12 @@ static int io_prompt(Sfio_t *iop,register int flag)
char *endprompt;
static short cmdno;
int sfflags;
int was_ttywait_on;
if(flag<3 && !sh_isstate(SH_INTERACTIVE))
flag = 0;
if(flag==2 && sfpkrd(sffileno(iop),buff,1,'\n',0,1) >= 0)
flag = 0;
if(flag==0)
return(sfsync(sfstderr));
/* Temporarily disable 'set -o notify' while expanding the prompt to avoid
possible crashes (https://github.com/ksh93/ksh/issues/103). */
was_ttywait_on = sh_isstate(SH_TTYWAIT);
sh_offstate(SH_TTYWAIT);
sfflags = sfset(sfstderr,SF_SHARE|SF_PUBLIC|SF_READ,0);
if(!(sh.prompt=(char*)sfreserve(sfstderr,0,0)))
sh.prompt = "";
@ -2197,8 +2192,6 @@ static int io_prompt(Sfio_t *iop,register int flag)
done:
if(*sh.prompt && (endprompt=(char*)sfreserve(sfstderr,0,0)))
*endprompt = 0;
if(was_ttywait_on)
sh_onstate(SH_TTYWAIT); /* re-enable 'set -o notify' */
sfset(sfstderr,sfflags&SF_READ|SF_SHARE|SF_PUBLIC,1);
return(sfsync(sfstderr));
}