Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Humblet <phumblet@phumblet.no-ip.org>2008-12-31 04:44:36 +0300
committerPierre Humblet <phumblet@phumblet.no-ip.org>2008-12-31 04:44:36 +0300
commit0b451bb524d7f80e7f7fa3c2284d4daf46ebaaa1 (patch)
tree0ffadb7736af2a27179384ed76230e89c88d98df /winsup/utils/cygcheck.cc
parentb837af5478b5b30cdaa2bdd194a442e44855e0b6 (diff)
* cygcheck.cc (pretty_id): Quote the path for popen.
(dump_sysinfo_services): Ditto.
Diffstat (limited to 'winsup/utils/cygcheck.cc')
-rw-r--r--winsup/utils/cygcheck.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/winsup/utils/cygcheck.cc b/winsup/utils/cygcheck.cc
index 9a04cb41b..b4b16dec9 100644
--- a/winsup/utils/cygcheck.cc
+++ b/winsup/utils/cygcheck.cc
@@ -1032,9 +1032,10 @@ pretty_id (const char *s, char *cygwin, size_t cyglen)
return;
}
- FILE *f = popen (id, "rt");
-
char buf[16384];
+ snprintf (buf, sizeof (buf), "\"%s\"", id);
+ FILE *f = popen (buf, "rt");
+
buf[0] = '\0';
fgets (buf, sizeof (buf), f);
pclose (f);
@@ -1118,7 +1119,7 @@ dump_sysinfo_services ()
}
/* check for a recent cygrunsrv */
- snprintf (buf, sizeof (buf), "%s --version", cygrunsrv);
+ snprintf (buf, sizeof (buf), "\"%s\" --version", cygrunsrv);
if ((f = popen (buf, "rt")) == NULL)
{
printf ("Failed to execute '%s', skipping services check.\n", buf);
@@ -1136,7 +1137,7 @@ dump_sysinfo_services ()
/* For verbose mode, just run cygrunsrv --list --verbose and copy output
verbatim; otherwise run cygrunsrv --list and then cygrunsrv --query for
each service. */
- snprintf (buf, sizeof (buf), (verbose ? "%s --list --verbose" : "%s --list"),
+ snprintf (buf, sizeof (buf), (verbose ? "\"%s\" --list --verbose" : "%s --list"),
cygrunsrv);
if ((f = popen (buf, "rt")) == NULL)
{
@@ -1167,7 +1168,7 @@ dump_sysinfo_services ()
if (nchars > 0)
for (char *srv = strtok (buf, "\n"); srv; srv = strtok (NULL, "\n"))
{
- snprintf (buf2, sizeof (buf2), "%s --query %s", cygrunsrv, srv);
+ snprintf (buf2, sizeof (buf2), "\"%s\" --query %s", cygrunsrv, srv);
if ((f = popen (buf2, "rt")) == NULL)
{
printf ("Failed to execute '%s', skipping services check.\n", buf2);