From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin-patches@cygwin.com
Subject: [PATCH] Cygwin: pty: Use find_exec() rather than path_conv::check().
Date: Mon, 5 Apr 2021 17:32:13 +0900 [thread overview]
Message-ID: <20210405083213.978-1-takashi.yano@nifty.ne.jp> (raw)
- With this patch, find_exec() rather than path_conv::check() is used
in order to enable searching executable file in the path.
---
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 4601a0b5c..22e6da5fd 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -219,19 +219,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;
@@ -282,19 +283,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;
--
2.31.1
reply other threads:[~2021-04-05 8:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210405083213.978-1-takashi.yano@nifty.ne.jp \
--to=takashi.yano@nifty.ne.jp \
--cc=cygwin-patches@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).