summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2006-05-19 23:44:46 +0300
committerSteve Peters <steve@fisharerojo.org>2006-05-19 18:36:13 +0000
commite9ed3d63ac53380ed6569edb3c52e2816feeab35 (patch)
treec6a465dc1c74cffc58880835ec79ef29d65403fa /doio.c
parentf8225f8afdb4886e3a792f44a7d91c93463cbb78 (diff)
downloadperl-e9ed3d63ac53380ed6569edb3c52e2816feeab35.tar.gz
strlcat aaargh
Message-ID: <446E040E.8030205@gmail.com> p4raw-id: //depot/perl@28237
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/doio.c b/doio.c
index a7dc9d9e2a..39ba56d73a 100644
--- a/doio.c
+++ b/doio.c
@@ -76,7 +76,7 @@ Perl_do_openn(pTHX_ GV *gv, register const char *oname, I32 len, int as_raw,
bool was_fdopen = FALSE;
bool in_raw = 0, in_crlf = 0, out_raw = 0, out_crlf = 0;
char *type = NULL;
- char mode[PERL_MODE_MAX]; /* stdio file mode ("r\0", "rb\0", "r+b\0" etc.) */
+ char mode[PERL_MODE_MAX]; /* file mode ("r\0", "rb\0", "ab\0" etc.) */
SV *namesv;
Zero(mode,sizeof(mode),char);
@@ -261,9 +261,9 @@ Perl_do_openn(pTHX_ GV *gv, register const char *oname, I32 len, int as_raw,
writing = 1;
#ifdef HAS_STRLCAT
if (out_raw)
- strlcat(mode, "b", PERL_MODE_MAX);
+ strlcat(mode, "b", PERL_MODE_MAX - 1);
else if (out_crlf)
- strlcat(mode, "t", PERL_MODE_MAX);
+ strlcat(mode, "t", PERL_MODE_MAX - 1);
#else
if (out_raw)
strcat(mode, "b");
@@ -299,9 +299,9 @@ Perl_do_openn(pTHX_ GV *gv, register const char *oname, I32 len, int as_raw,
#ifdef HAS_STRLCAT
if (out_raw)
- strlcat(mode, "b", PERL_MODE_MAX);
+ strlcat(mode, "b", PERL_MODE_MAX - 1);
else if (out_crlf)
- strlcat(mode, "t", PERL_MODE_MAX);
+ strlcat(mode, "t", PERL_MODE_MAX - 1);
#else
if (out_raw)
strcat(mode, "b");
@@ -432,9 +432,9 @@ Perl_do_openn(pTHX_ GV *gv, register const char *oname, I32 len, int as_raw,
mode[0] = 'r';
#ifdef HAS_STRLCAT
if (in_raw)
- strlcat(mode, "b", PERL_MODE_MAX);
+ strlcat(mode, "b", PERL_MODE_MAX - 1);
else if (in_crlf)
- strlcat(mode, "t", PERL_MODE_MAX);
+ strlcat(mode, "t", PERL_MODE_MAX - 1);
#else
if (in_raw)
strcat(mode, "b");
@@ -493,9 +493,9 @@ Perl_do_openn(pTHX_ GV *gv, register const char *oname, I32 len, int as_raw,
#ifdef HAS_STRLCAT
if (in_raw)
- strlcat(mode, "b", PERL_MODE_MAX);
+ strlcat(mode, "b", PERL_MODE_MAX - 1);
else if (in_crlf)
- strlcat(mode, "t", PERL_MODE_MAX);
+ strlcat(mode, "t", PERL_MODE_MAX - 1);
#else
if (in_raw)
strcat(mode, "b");
@@ -531,9 +531,9 @@ Perl_do_openn(pTHX_ GV *gv, register const char *oname, I32 len, int as_raw,
#ifdef HAS_STRLCAT
if (in_raw)
- strlcat(mode, "b", PERL_MODE_MAX);
+ strlcat(mode, "b", PERL_MODE_MAX - 1);
else if (in_crlf)
- strlcat(mode, "t", PERL_MODE_MAX);
+ strlcat(mode, "t", PERL_MODE_MAX - 1);
#else
if (in_raw)
strcat(mode, "b");
@@ -1491,7 +1491,7 @@ Perl_do_exec3(pTHX_ const char *incmd, int fd, int do_report)
if (*s == 'f') {
s++;
#ifdef HAS_STRLCPY
- strlcat(flags, "f", PERL_FLAGS_MAX);
+ strlcat(flags, "f", PERL_FLAGS_MAX - 2);
#else
strcat(flags,"f");
#endif