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

sh_done(): fix portable exit status logic (re: d024d4c8)

"savxit -= SH_EXITSIG + 128;" may have worked accidentally due to
subsequent bitmasking, but is blatantly wrong . It subtracts 256 +
128 = 384 from the exit status.

Use bitwise logic instead, with an octal literal 0200 instead of
128. This makes more sense in this context.
This commit is contained in:
Martijn Dekker 2021-03-17 09:33:23 +00:00
parent aacf0d0b66
commit 44438725b1

View file

@ -677,7 +677,7 @@ void sh_done(void *ptr, register int sig)
/* Exit with portable 8-bit status (128 + signum) if last child process exits due to signal */ /* Exit with portable 8-bit status (128 + signum) if last child process exits due to signal */
if (savxit & SH_EXITSIG) if (savxit & SH_EXITSIG)
savxit -= SH_EXITSIG + 128; savxit = savxit & ~SH_EXITSIG | 0200;
exit(savxit&SH_EXITMASK); exit(savxit&SH_EXITMASK);
} }