while thinking about mirlibₘᵢₙc I figured that sys_errlist[] entries may be NULL

This commit is contained in:
tg 2013-01-01 03:32:44 +00:00
parent 23325a3355
commit 0700d45ce6
3 changed files with 7 additions and 7 deletions

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.582 2012/12/28 07:45:55 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.583 2013/01/01 03:32:41 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -29,7 +29,7 @@
# http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD
expected-stdout:
@(#)MIRBSD KSH R41 2012/12/27
@(#)MIRBSD KSH R41 2012/12/31
description:
Check version of shell.
stdin:
@ -38,7 +38,7 @@ name: KSH_VERSION
category: shell:legacy-no
---
expected-stdout:
@(#)LEGACY KSH R41 2012/12/27
@(#)LEGACY KSH R41 2012/12/31
description:
Check version of legacy shell.
stdin:

4
sh.h
View File

@ -164,9 +164,9 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.624 2012/12/28 04:47:50 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.625 2013/01/01 03:32:43 tg Exp $");
#endif
#define MKSH_VERSION "R41 2012/12/27"
#define MKSH_VERSION "R41 2012/12/31"
/* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES

4
shf.c
View File

@ -24,7 +24,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.55 2012/12/28 03:20:35 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.56 2013/01/01 03:32:44 tg Exp $");
/* flags to shf_emptybuf() */
#define EB_READSW 0x01 /* about to switch to reading */
@ -1102,7 +1102,7 @@ cstrerror(int errnum)
static char errbuf[15 + 1 + (8 * sizeof(int) + 2) / 3 + 1];
#if HAVE_SYS_ERRLIST
if (errnum > 0 && errnum < sys_nerr)
if (errnum > 0 && errnum < sys_nerr && sys_errlist[errnum])
return (sys_errlist[errnum]);
#endif