From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id CFDD43858034; Tue, 6 Apr 2021 10:17:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CFDD43858034 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: pty: Use find_exec() rather than path_conv::check(). X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/master X-Git-Oldrev: fdda29fb57cb2958b941bc7315493e73137e2ecf X-Git-Newrev: ba2fbfec95b03ccd01c4d3f5a5179e7cc5f95e19 Message-Id: <20210406101735.CFDD43858034@sourceware.org> Date: Tue, 6 Apr 2021 10:17:35 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 10:17:35 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=ba2fbfec95b03ccd01c4d3f5a5179e7cc5f95e19 commit ba2fbfec95b03ccd01c4d3f5a5179e7cc5f95e19 Author: Takashi Yano Date: Mon Apr 5 17:32:13 2021 +0900 Cygwin: pty: Use find_exec() rather than path_conv::check(). - With this patch, find_exec() rather than path_conv::check() is used in order to enable searching executable file in the path. Diff: --- winsup/cygwin/fhandler_tty.cc | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 12247dd99..d78afb3ad 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -183,19 +183,20 @@ CreateProcessA_Hooked char *p = prog; char *p1; do - if ((p1 = strstr (p, ".exe")) || (p1 = strstr (p, ".com"))) + if ((p1 = strchr (p, ' ')) || (p1 = p + strlen (p))) { - p = p1 + 4; + p = p1; if (*p == ' ') { *p = '\0'; - path.check (prog); + find_exec (prog, path); *p = ' '; + p ++; } else if (*p == '\0') - path.check (prog); + find_exec (prog, path); } - while (!path.exists() && p1); + while (!path.exists() && *p); } const char *argv[] = {"", NULL}; /* Dummy */ av av1; @@ -239,19 +240,20 @@ CreateProcessW_Hooked char *p = prog; char *p1; do - if ((p1 = strstr (p, ".exe")) || (p1 = strstr (p, ".com"))) + if ((p1 = strchr (p, ' ')) || (p1 = p + strlen (p))) { - p = p1 + 4; + p = p1; if (*p == ' ') { *p = '\0'; - path.check (prog); + find_exec (prog, path); *p = ' '; + p ++; } else if (*p == '\0') - path.check (prog); + find_exec (prog, path); } - while (!path.exists() && p1); + while (!path.exists() && *p); } const char *argv[] = {"", NULL}; /* Dummy */ av av1;