diff options
-rw-r--r-- | metaconfig.h | 2 | ||||
-rw-r--r-- | pp_sys.c | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/metaconfig.h b/metaconfig.h index 96a02a57eb..baba5eac68 100644 --- a/metaconfig.h +++ b/metaconfig.h @@ -13,5 +13,5 @@ * Symbols should only be here temporarily. Once they are actually used, * they should be removed from here. * - * HAS_WCRTOMB HAS_SOCKADDR_STORAGE + * HAS_WCRTOMB */ @@ -2763,9 +2763,13 @@ PP(pp_getpeername) if (!IoIFP(io)) goto nuts; - sv = sv_2mortal(newSV(257)); - (void)SvPOK_only(sv); +#ifdef HAS_SOCKADDR_STORAGE + len = sizeof(struct sockaddr_storage); +#else len = 256; +#endif + sv = sv_2mortal(newSV(len+1)); + (void)SvPOK_only(sv); SvCUR_set(sv, len); *SvEND(sv) ='\0'; fd = PerlIO_fileno(IoIFP(io)); |