1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 11:42:21 +00:00

typeset: Fix stack fencepost error, ISO C90 compat (#159)

src/cmd/ksh93/bltins/typeset.c:
- The new_argv[] array was one item too short (should be argc+2).
- Use AST stakalloc(3) to allocate it instead of a dynamic array;
  this restores compatibility with ISO C90.

src/lib/libast/features/standards, src/cmd/INIT/cc.unixware.i386:
- Add support for UnixWare.
- Do not define any standards macros on this system, as on FreeBSD
  and DragonFly BSD.
This commit is contained in:
Lev Kujawski 2021-01-21 00:50:07 -07:00 committed by GitHub
parent bb4d6a2ee5
commit ff70c27f24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 4 deletions

View file

@ -60,7 +60,7 @@ cc ld ldd :PACKAGE_INIT: mamake.c proto.c ratz.c release.c
cc.sco.i386 \
cc.sgi.mips2 cc.sgi.mips3 cc.sgi.mips3-o32 cc.sgi.mips4 \
cc.sgi.mips4-n32 ldd.sgi \
cc.unix.mc68k
cc.unix.mc68k cc.unixware.i386
LICENSE : .DONTCARE

9
src/cmd/INIT/cc.unixware.i386 Executable file
View file

@ -0,0 +1,9 @@
: unixware.i386 cc wrapper
HOSTTYPE=unixware.i386
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
/bin/cc -D_XOPEN_UNIX -D_XOPEN_SOURCE_EXTENDED "$@"

View file

@ -196,8 +196,9 @@ int b_typeset(int argc,register char *argv[],Shbltin_t *context)
Namdecl_t *ntp = (Namdecl_t*)context->ptr;
Dt_t *troot;
int isfloat=0, shortint=0, sflag=0;
char *new_argv[argc + 1];
char **new_argv;
new_argv = (char **)stakalloc((argc + 2) * sizeof(char*));
memset((void*)&tdata,0,sizeof(tdata));
tdata.sh = context->shp;
troot = tdata.sh->var_tree;

View file

@ -6,9 +6,9 @@ set stdio
# careful that we don't get fooled by presence of FreeBSD that underpins some
# subsystems in Mac OS X; there are other Apple-specific portability hacks
# elsewhere we should not interfere with.
if tst note{ FreeBSD or DragonFly BSD }end compile{
if tst note{ FreeBSD, DragonFly BSD, or UnixWare }end compile{
#include <sys/param.h>
#if (!defined(__FreeBSD__) && !defined(__DragonFly__)) || defined(APPLE)
#if (!defined(__FreeBSD__) && !defined(__DragonFly__) && !defined(__USLC__)) || defined(APPLE)
#error not a FreeBSD or DragonFly BSD system
#endif
}end {