be more careful with signals and errorlevels; bounds-check them better;

don’t trust the OS as POSuX comes up with more-than-8-bit exit codes now;
also, one more int → bool
This commit is contained in:
tg
2015-08-13 21:38:19 +00:00
parent 9d30e9c9d6
commit c674e71377
4 changed files with 48 additions and 37 deletions

12
sh.h
View File

@@ -172,9 +172,9 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.739 2015/07/10 19:36:37 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.740 2015/08/13 21:38:19 tg Exp $");
#endif
#define MKSH_VERSION "R51 2015/07/10"
#define MKSH_VERSION "R51 2015/08/13"
/* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES
@@ -337,15 +337,15 @@ struct rusage {
/* determine ksh_NSIG: first, use the traditional definitions */
#undef ksh_NSIG
#if defined(NSIG)
#define ksh_NSIG NSIG
#define ksh_NSIG (NSIG)
#elif defined(_NSIG)
#define ksh_NSIG _NSIG
#define ksh_NSIG (_NSIG)
#elif defined(SIGMAX)
#define ksh_NSIG (SIGMAX + 1)
#elif defined(_SIGMAX)
#define ksh_NSIG (_SIGMAX + 1)
#elif defined(NSIG_MAX)
#define ksh_NSIG NSIG_MAX
#define ksh_NSIG (NSIG_MAX)
#else
# error Please have your platform define NSIG.
#endif
@@ -367,7 +367,7 @@ struct rusage {
#else
/* since its usable, prefer it */
#undef ksh_NSIG
#define ksh_NSIG NSIG_MAX
#define ksh_NSIG (NSIG_MAX)
#endif
/* if NSIG_MAX is now still defined, use sysconf(_SC_NSIG) at runtime */
#endif