Validate that the configuration parameters that are supposed to

be numeric are in fact numeric, and then have the awk script use
them as awk numbers, rather than strings, so awk isn't doing string
comparisons on numbers (where "1024" < 2).

This has no effect with current configuratons, but would if anyone
had ever attempted to configure a system with nsysent >= 1000
This commit is contained in:
kre 2018-08-26 11:48:00 +00:00
parent 00ac29de45
commit a36884b3bd
1 changed files with 12 additions and 9 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: makesyscalls.sh,v 1.170 2018/08/10 21:44:59 pgoyette Exp $
# $NetBSD: makesyscalls.sh,v 1.171 2018/08/26 11:48:00 kre Exp $
#
# Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou
# All rights reserved.
@ -78,6 +78,15 @@ case $1 in
*) . ./$1;;
esac
fail=false
case "${nsysent:-0}" in
*[!0-9]*) fail=true; printf >&2 '%s\n' "Non numeric value for nsysent";;
esac
case "${maxsysargs:-0}" in
*[!0-9]*) fail=true; printf >&2 '%s\n' "Non numeric value for maxsysargs";;
esac
$fail && exit 1
# tmp files:
sysdcl="sysent.dcl"
sysprotos="sys.protos"
@ -172,7 +181,7 @@ BEGIN {
if (!registertype) {
registertype = \"register_t\"
}
nsysent = \"$nsysent\"
nsysent = ${nsysent:-0}
sysdcl = \"$sysdcl\"
syscompat_pref = \"$syscompat_pref\"
@ -182,7 +191,7 @@ BEGIN {
rumpprotos = \"$rumpprotos\"
rumptypes = \"$rumptypes\"
sys_nosys = \"$sys_nosys\"
maxsysargs = \"$maxsysargs\"
maxsysargs = ${maxsysargs:-8}
rumpnoflags=\"$rumpnoflags\"
rumpnosys=\"$rumpnosys\"
rumpnomodule=\"$rumpnomodule\"
@ -1130,12 +1139,6 @@ END {
maxsyscall = syscall
# XXX
# XXX The following comparisons with nsysent will produce
# XXX unexpected results if (for example) syscall has a
# XXX value of 900 and nsysent has a value of "1024". We
# XXX probably ought to make nsysent a numeric variable.
# XXX
if (nsysent) {
if (syscall > nsysent) {
printf("%s: line %d: too many syscalls [%d > %d]\n", infile, NR, syscall, nsysent)