summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/winf.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2006-04-13 01:37:00 +0000
committerChristopher Faylor <me@cgf.cx>2006-04-13 01:37:00 +0000
commit2e9d484382fe45ff1dcd325be0992b1857f9498d (patch)
tree7f5255426ee768252260a908ffd9bec6cf87b108 /winsup/cygwin/winf.cc
parenta5eaf568177c2d765f704490eb56628e9cec653d (diff)
downloadcygnal-2e9d484382fe45ff1dcd325be0992b1857f9498d.tar.gz
cygnal-2e9d484382fe45ff1dcd325be0992b1857f9498d.tar.bz2
cygnal-2e9d484382fe45ff1dcd325be0992b1857f9498d.zip
* spawn.cc (spawn_guts): Revert patch which treated derived cygwin programs
differently from those which are mounted with -X. Pass extra argument to linebuf::fromargv. * winf.h (MAXCYGWINCMDLEN): New define. (linebuf::finish): Add a new argument denoting when command line overflow is ok. (linebuf::fromargv): Ditto. * winf.cc (linebuf::finish): Implement above change. (linebuf::fromargv): Ditto.
Diffstat (limited to 'winsup/cygwin/winf.cc')
-rw-r--r--winsup/cygwin/winf.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/winsup/cygwin/winf.cc b/winsup/cygwin/winf.cc
index 01c5cfb65..81c58db4f 100644
--- a/winsup/cygwin/winf.cc
+++ b/winsup/cygwin/winf.cc
@@ -19,12 +19,16 @@ details. */
#include "sys/cygwin.h"
void
-linebuf::finish ()
+linebuf::finish (bool cmdlenoverflow_ok)
{
if (!ix)
add ("", 1);
else
- buf[--ix] = '\0';
+ {
+ if (ix-- > MAXCYGWINCMDLEN && cmdlenoverflow_ok)
+ ix = MAXCYGWINCMDLEN - 1;
+ buf[ix] = '\0';
+ }
}
void
@@ -61,7 +65,7 @@ linebuf::prepend (const char *what, int len)
}
bool
-linebuf::fromargv (av& newargv, char *real_path)
+linebuf::fromargv (av& newargv, char *real_path, bool cmdlenoverflow_ok)
{
bool success = true;
for (int i = 0; i < newargv.argc; i++)
@@ -110,7 +114,7 @@ linebuf::fromargv (av& newargv, char *real_path)
add (" ", 1);
}
- finish ();
+ finish (cmdlenoverflow_ok);
if (ix >= MAXWINCMDLEN)
{