From 13826f2cf81099b832a12ff02c10a2f9d23cd6e5 Mon Sep 17 00:00:00 2001 From: Chip Salzenberg Date: Mon, 23 Dec 1996 12:58:58 +1200 Subject: [PATCH] Fixes for Interactive Unix (this is the same change as commit 1ab5d0547ab7398ea9e3e00b1c1b0f1f8ea0dd94, but as applied) --- hints/isc.sh | 3 +++ op.c | 4 ++-- pp_sys.c | 8 +++++++- universal.c | 5 +++-- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/hints/isc.sh b/hints/isc.sh index df745a9b25..5860acc0c6 100644 --- a/hints/isc.sh +++ b/hints/isc.sh @@ -28,6 +28,9 @@ case "$cc" in ;; esac +# getsockname() and getpeername() return 256 for no good reason +ccflags="$ccflags -DBOGUS_GETNAME_RETURN=256" + # You can also include -D_SYSV3 to pick up "traditionally visible" # symbols hidden by name-space pollution rules. This raises some # compilation "redefinition" warnings, but they appear harmless. diff --git a/op.c b/op.c index 56624e3759..619b675c04 100644 --- a/op.c +++ b/op.c @@ -186,7 +186,7 @@ pad_findlex(char *name, PADOFFSET newoff, U32 seq, CV* startcv, I32 cx_ix) if ((sv = svp[off]) && sv != &sv_undef && seq <= SvIVX(sv) && - seq > (I32)SvNVX(sv) && + seq > I_32(SvNVX(sv)) && strEQ(SvPVX(sv), name)) { I32 depth; @@ -277,7 +277,7 @@ char *name; if ((sv = svp[off]) && sv != &sv_undef && seq <= SvIVX(sv) && - seq > (I32)SvNVX(sv) && + seq > I_32(SvNVX(sv)) && strEQ(SvPVX(sv), name)) { return (PADOFFSET)off; diff --git a/pp_sys.c b/pp_sys.c index 5e096feff8..72b8df5481 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -121,7 +121,7 @@ static int dooneliner _((char *cmd, char *filename)); # endif /* no flock() or fcntl(F_SETLK,...) */ # ifdef FLOCK - static int FLOCK(int, int); + static int FLOCK _((int, int)); /* * These are the flock() constants. Since this sytems doesn't have @@ -1860,6 +1860,12 @@ PP(pp_getpeername) goto nuts2; break; } +#ifdef BOGUS_GETNAME_RETURN + /* Interactive Unix, getpeername() and getsockname() + does not return valid namelen */ + if (aint == BOGUS_GETNAME_RETURN) + aint = sizeof(struct sockaddr); +#endif SvCUR_set(sv,aint); *SvEND(sv) ='\0'; PUSHs(sv); diff --git a/universal.c b/universal.c index 476b60d3c0..74d182d953 100644 --- a/universal.c +++ b/universal.c @@ -198,6 +198,7 @@ XS(XS_UNIVERSAL_VERSION) GV *gv; SV *sv; char *undef; + double req; if(SvROK(ST(0))) { sv = (SV*)SvRV(ST(0)); @@ -222,9 +223,9 @@ XS(XS_UNIVERSAL_VERSION) undef = "(undef)"; } - if(items > 1 && (undef || SvNV(ST(1)) > SvNV(sv))) + if (items > 1 && (undef || (req = SvNV(ST(1)), req > SvNV(sv)))) croak("%s version %s required--this is only version %s", - HvNAME(pkg),SvPV(ST(1),na),undef ? undef : SvPV(sv,na)); + HvNAME(pkg), SvPV(ST(1),na), undef ? undef : SvPV(sv,na)); ST(0) = sv; -- 2.34.1