Re: bug & patch: exit codes from internal commands are handled incorrectly
- From
Torsten Bögershausen <tboegi@web.de>
- Date
- Dec 18, 2014, 17:43 UTC
- Message-ID
- <54931233.6080900@web.de>
- In-Reply-To
- <885593BD-3024-4811-83A5-D3A0C4CE6AC1@his.com>
On 18.12.14 03:15, Kenneth Lorber wrote:
Show 9 quoted lines
> The situation is actually slightly more complex than I stated previously. From the docs: > The exit value of this program is negative on error, > But there’s no such thing as a negative error code under Unix, so (at best) that will be exit(255). > > No patch, because this is getting painfully close to needing someone with a global view of the code to fix. > > Thanks, > Keni >
My spontanous question: Would it be save to clamp at 127 ?
>> + if (status > 127) >> + status = 127; /* prevent exit() from truncating to 0 or becoming negative */
(And the rest looked good enough to become a patch, or at least to start a wider discussion)