From 4eafa56ec21fe0f92d28ec65abf53a44e8730b4d Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Tue, 26 Sep 2000 00:52:21 +0000 Subject: [PATCH] * dcrt0.cc (quoted): Fix problem where ' quoted strings were skipped. * fhandler.h (fhandler_socket::~fhandler_socket): Delete declaration. * net.cc: Remove unnecessary "number_of_sockets" usage. (fhandler_socket::fhandler_socket): Ditto. (fhandler_socket::~fhandler_socket): Delete definition. * spawn.cc (spawn_guts): Force first argument passed to CreateProcess as a command line to be windows style. --- winsup/cygwin/ChangeLog | 10 ++++++++++ winsup/cygwin/dcrt0.cc | 9 ++++----- winsup/cygwin/fhandler.h | 1 - winsup/cygwin/net.cc | 15 --------------- winsup/cygwin/spawn.cc | 2 +- 5 files changed, 15 insertions(+), 22 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index f051c2c3b..cc99e87b4 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,13 @@ +Mon Sep 25 20:47:04 2000 Christopher Faylor + + * dcrt0.cc (quoted): Fix problem where ' quoted strings were skipped. + * fhandler.h (fhandler_socket::~fhandler_socket): Delete declaration. + * net.cc: Remove unnecessary "number_of_sockets" usage. + (fhandler_socket::fhandler_socket): Ditto. + (fhandler_socket::~fhandler_socket): Delete definition. + * spawn.cc (spawn_guts): Force first argument passed to CreateProcess + as a command line to be windows style. + 2000-09-25 Christopher Faylor * spawn.cc (av::dup_maybe): Make function void rather than void *. diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index e20bfc21f..4e8ff9cf9 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -312,19 +312,18 @@ quoted (char *cmd, int winshell) return p; } + const char *s = quote == '\'' ? "'" : "\\\""; /* This must have been run from a Windows shell, so preserve quotes for globify to play with later. */ - while (*++cmd) - if ((p = strpbrk (cmd, "\\\"")) == NULL) + while (*cmd && *++cmd) + if ((p = strpbrk (cmd, s)) == NULL) { cmd = strchr (cmd, '\0'); // no closing quote break; } - else if (quote == '\'') - continue; else if (*p == '\\') cmd = ++p; - else if (p[1] == quote) + else if (quote == '"' && p[1] == '"') { *p = '\\'; cmd = ++p; // a quoted quote diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index df9153e9d..d3fc19565 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -314,7 +314,6 @@ private: public: fhandler_socket (const char *name = 0); fhandler_socket (unsigned int, const char *name = 0); - ~fhandler_socket (); int get_socket () const { return (int) get_handle(); } fhandler_socket * is_socket () { return this; } int write (const void *ptr, size_t len); diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 932428ba0..30c0000d5 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -33,11 +33,6 @@ details. */ #include "pinfo.h" #include "registry.h" -/* We only want to initialize WinSock in a child process if socket - handles are inheritted. This global allows us to know whether this - should be done or not */ -int number_of_sockets = 0; - extern "C" { int h_errno; @@ -1584,7 +1579,6 @@ fhandler_socket::fhandler_socket (const char *name) : fhandler_base (FH_SOCKET, name) { set_cb (sizeof *this); - number_of_sockets++; } /* sethostent: standards? */ @@ -1601,15 +1595,6 @@ endhostent (void) { } -fhandler_socket::~fhandler_socket () -{ - if (--number_of_sockets < 0) - { - number_of_sockets = 0; - system_printf("socket count < 0"); - } -} - int fhandler_socket::read (void *ptr, size_t len) { diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 032082cf3..09a1b8cef 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -496,7 +496,7 @@ spawn_guts (HANDLE hToken, const char * prog_arg, const char *const *argv, const char *a; newargv.dup_maybe (i); - a = newargv[i]; + a = i ? newargv[i] : (char *) real_path; int len = strlen (a); if (len != 0 && !strpbrk (a, " \t\n\r\"")) one_line.add (a, len);