* 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.
This commit is contained in:
Christopher Faylor
2006-04-13 01:37:00 +00:00
parent a5eaf56817
commit 2e9d484382
4 changed files with 35 additions and 9 deletions

View File

@@ -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)
{