[Spice-devel] [PATCH] plugin: try to run only /usr/libexec/spice-xpi-client

Marc-André Lureau marcandre.lureau at gmail.com
Mon Jun 27 15:55:31 PDT 2011


Although not really important, the previous code was racy (stat + exec).

I propose running /usr/libexec/spice-xpi-client without parameters,
which could be a shell script with the required arguments to call
spicec or other spice clients (and could be easily tweaked to run
various clients depending on environment etc..)
---
 SpiceXPI/src/plugin/plugin.cpp |   30 +++---------------------------
 1 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/SpiceXPI/src/plugin/plugin.cpp b/SpiceXPI/src/plugin/plugin.cpp
index 793f2ba..a6fae60 100644
--- a/SpiceXPI/src/plugin/plugin.cpp
+++ b/SpiceXPI/src/plugin/plugin.cpp
@@ -105,23 +105,6 @@ namespace {
 
         return dest;
     }
-
-    std::string getSpicecPath()
-    {
-        std::set<std::string> names;
-        names.insert("/usr/libexec/spicec");
-        names.insert("/usr/bin/spicec");
-
-        struct stat file;
-        std::set<std::string>::iterator it;
-        for (it = names.begin(); it != names.end(); ++it)
-        {
-            if (stat(it->c_str(), &file) == 0)
-                return *it;
-        }
-
-        return std::string();
-    }
 }
 
 char *NPP_GetMIMEDescription(void)
@@ -564,18 +547,11 @@ void nsPluginInstance::Connect()
     LOG_DEBUG(" m_child_pid = " << m_child_pid);
     if (m_child_pid == 0)
     {
-        std::string spicec_path = getSpicecPath();
-        if (spicec_path.empty())
-        {
-            LOG_ERROR("ERROR failed to find spicec to run");
-            exit(1);
-        }
-
-        // run the controller
-        execl(spicec_path.c_str(), spicec_path.c_str(), "--controller", NULL);
+        execl("/usr/libexec/spice-xpi-client", "/usr/libexec/spice-xpi-client", NULL);
 
         // failed to connect?
-        exit(0);
+        LOG_ERROR("ERROR failed to run spice-xpi-client");
+        exit(1);
     }
     else
     {
-- 
1.7.5.2



More information about the Spice-devel mailing list